Add web app manifest and register service worker on login
This commit is contained in:
1 parent
7904207f64
commit
e011f3bafa
3 files changed
+25
No files matched your search
@@ -7,6 +7,7 @@
|
|||||||
<title>You Know Who Else Was In That Movie?</title>
|
<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="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" />
|
<meta name="theme-color" content="#1e1b30" />
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
|
|
||||||
<!-- Open Graph -->
|
<!-- Open Graph -->
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
|
|||||||
@@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { create } from 'zustand';
|
import { create } from 'zustand';
|
||||||
import * as authApi from '@/api/auth';
|
import * as authApi from '@/api/auth';
|
||||||
import { useNotificationStore } from '@/stores/notification-store';
|
import { useNotificationStore } from '@/stores/notification-store';
|
||||||
|
import { registerServiceWorker } from '@/lib/push';
|
||||||
|
|
||||||
interface User {
|
interface User {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -32,6 +33,7 @@ export const useAuthStore = create<AuthState>((set) => ({
|
|||||||
localStorage.setItem('auth_token', response.access_token);
|
localStorage.setItem('auth_token', response.access_token);
|
||||||
set({ user: response.user, isLoading: false });
|
set({ user: response.user, isLoading: false });
|
||||||
useNotificationStore.getState().connect();
|
useNotificationStore.getState().connect();
|
||||||
|
registerServiceWorker();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
const message =
|
const message =
|
||||||
err.response?.data?.message || 'Login failed. Please try again.';
|
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);
|
localStorage.setItem('auth_token', response.access_token);
|
||||||
set({ user: response.user, isLoading: false });
|
set({ user: response.user, isLoading: false });
|
||||||
useNotificationStore.getState().connect();
|
useNotificationStore.getState().connect();
|
||||||
|
registerServiceWorker();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
const message =
|
const message =
|
||||||
err.response?.data?.message || 'Registration failed. Please try again.';
|
err.response?.data?.message || 'Registration failed. Please try again.';
|
||||||
@@ -70,6 +73,7 @@ export const useAuthStore = create<AuthState>((set) => ({
|
|||||||
const profile = await authApi.getProfile();
|
const profile = await authApi.getProfile();
|
||||||
set({ user: { id: profile.id, email: profile.email, username: profile.username, isAdmin: profile.isAdmin ?? false }, isLoading: false });
|
set({ user: { id: profile.id, email: profile.email, username: profile.username, isAdmin: profile.isAdmin ?? false }, isLoading: false });
|
||||||
useNotificationStore.getState().connect();
|
useNotificationStore.getState().connect();
|
||||||
|
registerServiceWorker();
|
||||||
} catch {
|
} catch {
|
||||||
localStorage.removeItem('auth_token');
|
localStorage.removeItem('auth_token');
|
||||||
set({ user: null, isLoading: false });
|
set({ user: null, isLoading: false });
|
||||||
|
|||||||
Reference in new issue
Block a user