mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-06-22 04:11:32 +10:00
ca groundwork
This commit is contained in:
Vendored
+13
@@ -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>,
|
||||
}
|
||||
@@ -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 });
|
||||
};
|
||||
Reference in New Issue
Block a user