ca groundwork

This commit is contained in:
DecDuck
2024-10-07 22:35:54 +11:00
parent 1bd19ad917
commit bfafd2a044
44 changed files with 628 additions and 130 deletions
+13
View File
@@ -0,0 +1,13 @@
import type { Component } from "vue"
export type NavigationItem = {
prefix: string,
route: string,
label: string,
}
export type QuickActionNav = {
icon: Component,
notifications?: number,
action: () => Promise<void>,
}
+16
View File
@@ -0,0 +1,16 @@
import type { User } from "@prisma/client";
// undefined = haven't check
// null = check, no user
// {} = check, user
export const useUser = () => useState<User | undefined | null>(undefined);
export const updateUser = async () => {
const headers = useRequestHeaders(["cookie"]);
const user = useUser();
if (user.value === null) return;
// SSR calls have to be after uses
user.value = await $fetch<User | null>("/api/v1/whoami", { headers });
};