feat(SPA): screens for Sites and Authors

This commit is contained in:
Florian Sylvain committed 2026-10-14 23:00:50 +02:00
1 parent b34a173d83
commit 3d81d2c717
82 files changed
+10676 -37

No files matched your search

+19 -3
View File
@@ -1,6 +1,6 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { ApiError, useApi, type UserRole } from '@/composables/useApi'
import { computed, ref } from 'vue'
import { ApiError, useApi, type MeAuthor, type UserRole } from '@/composables/useApi'
export type SessionStatus = 'idle' | 'checking' | 'ready' | 'error'
@@ -11,6 +11,7 @@ export interface Session {
email?: string
displayName: string
role?: UserRole
author?: MeAuthor
}
export const useSessionStore = defineStore('session', () => {
@@ -18,6 +19,11 @@ export const useSessionStore = defineStore('session', () => {
const session = ref<Session | null>(null)
let pending: Promise<void> | null = null
const isOwner = computed(() => session.value?.role === 'owner')
const canManageContent = computed(
() => session.value?.role === 'owner' || session.value?.role === 'admin',
)
function check() {
if (pending) {
return pending
@@ -71,5 +77,15 @@ export const useSessionStore = defineStore('session', () => {
}
}
return { status, session, check, retry, refresh, clear, setDisplayName }
return {
status,
session,
isOwner,
canManageContent,
check,
retry,
refresh,
clear,
setDisplayName,
}
})