diff --git a/index.html b/index.html index 8d04ae9..4083546 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,7 @@ You Know Who Else Was In That Movie? + diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..c6a424e --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,20 @@ +{ + "name": "You Know Who Else Was In That Movie?", + "short_name": "Movie Loop", + "start_url": "/", + "display": "standalone", + "background_color": "#1e1b30", + "theme_color": "#1e1b30", + "icons": [ + { + "src": "/icon.jpg", + "sizes": "192x192", + "type": "image/jpeg" + }, + { + "src": "/icon.jpg", + "sizes": "512x512", + "type": "image/jpeg" + } + ] +} diff --git a/src/stores/auth-store.ts b/src/stores/auth-store.ts index bf9af19..57294f3 100644 --- a/src/stores/auth-store.ts +++ b/src/stores/auth-store.ts @@ -1,6 +1,7 @@ import { create } from 'zustand'; import * as authApi from '@/api/auth'; import { useNotificationStore } from '@/stores/notification-store'; +import { registerServiceWorker } from '@/lib/push'; interface User { id: string; @@ -32,6 +33,7 @@ export const useAuthStore = create((set) => ({ localStorage.setItem('auth_token', response.access_token); set({ user: response.user, isLoading: false }); useNotificationStore.getState().connect(); + registerServiceWorker(); } catch (err: any) { const message = err.response?.data?.message || 'Login failed. Please try again.'; @@ -47,6 +49,7 @@ export const useAuthStore = create((set) => ({ localStorage.setItem('auth_token', response.access_token); set({ user: response.user, isLoading: false }); useNotificationStore.getState().connect(); + registerServiceWorker(); } catch (err: any) { const message = err.response?.data?.message || 'Registration failed. Please try again.'; @@ -70,6 +73,7 @@ export const useAuthStore = create((set) => ({ const profile = await authApi.getProfile(); set({ user: { id: profile.id, email: profile.email, username: profile.username, isAdmin: profile.isAdmin ?? false }, isLoading: false }); useNotificationStore.getState().connect(); + registerServiceWorker(); } catch { localStorage.removeItem('auth_token'); set({ user: null, isLoading: false });