i18n front : facettes localisées + Web Push (SW push, abonnement, toggle profil)
Build & Deploy / build (push) Successful in 6s
Build & Deploy / build (push) Successful in 6s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-2
@@ -16,6 +16,7 @@ interface SfUser {
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
const user = ref<SfUser | null>(null)
|
||||
const streak = ref<{ current: number, longest: number, freezes: number } | null>(null)
|
||||
const push = ref<{ vapid_public_key: string | null, enabled: boolean }>({ vapid_public_key: null, enabled: false })
|
||||
const ready = ref(false)
|
||||
|
||||
const isAuthed = computed(() => !!user.value)
|
||||
@@ -23,9 +24,10 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
async function fetchMe() {
|
||||
const { api } = useApi()
|
||||
try {
|
||||
const res = await api<{ user: SfUser, streak: typeof streak.value }>('/api/me')
|
||||
const res = await api<{ user: SfUser, streak: typeof streak.value, push: typeof push.value }>('/api/me')
|
||||
user.value = res.user
|
||||
streak.value = res.streak
|
||||
if (res.push) push.value = res.push
|
||||
} catch {
|
||||
user.value = null
|
||||
streak.value = null
|
||||
@@ -65,5 +67,5 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
window.location.href = `${base}/auth/oidc/redirect`
|
||||
}
|
||||
|
||||
return { user, streak, ready, isAuthed, fetchMe, login, register, logout, loginWithPocketId }
|
||||
return { user, streak, push, ready, isAuthed, fetchMe, login, register, logout, loginWithPocketId }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user