Add web app manifest and register service worker on login

This commit is contained in:
2026-03-11 20:58:21 -07:00
parent 7904207f64
commit e011f3bafa
3 changed files with 25 additions and 0 deletions
+1
View File
@@ -7,6 +7,7 @@
<title>You Know Who Else Was In That Movie?</title>
<meta name="description" content="A trivia-puzzle game inspired by Six Degrees of Kevin Bacon. Build a chain of actor-movie connections forming a complete loop between two movies." />
<meta name="theme-color" content="#1e1b30" />
<link rel="manifest" href="/manifest.json" />
<!-- Open Graph -->
<meta property="og:type" content="website" />
+20
View File
@@ -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"
}
]
}
+4
View File
@@ -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<AuthState>((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<AuthState>((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<AuthState>((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 });