upgrade to tamagui v2 and guest pwa overhaul
This commit is contained in:
24
resources/js/guest-v2/services/emotionsApi.ts
Normal file
24
resources/js/guest-v2/services/emotionsApi.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { fetchJson } from './apiClient';
|
||||
import { getDeviceId } from '../lib/device';
|
||||
|
||||
export type EmotionItem = Record<string, unknown>;
|
||||
|
||||
type EmotionResponse = {
|
||||
data?: EmotionItem[];
|
||||
};
|
||||
|
||||
export async function fetchEmotions(eventToken: string, locale?: string) {
|
||||
const params = new URLSearchParams();
|
||||
if (locale) params.set('locale', locale);
|
||||
|
||||
const response = await fetchJson<EmotionResponse>(
|
||||
`/api/v1/events/${encodeURIComponent(eventToken)}/emotions${params.toString() ? `?${params.toString()}` : ''}`,
|
||||
{
|
||||
headers: {
|
||||
'X-Device-Id': getDeviceId(),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return response.data?.data ?? [];
|
||||
}
|
||||
Reference in New Issue
Block a user