mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-18 18:51:13 +10:00
update to nuxt 4
This commit is contained in:
13
app/composables/user.ts
Normal file
13
app/composables/user.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import type { UserModel } from "~~/prisma/client/models";
|
||||
|
||||
// undefined = haven't check
|
||||
// null = check, no user
|
||||
// {} = check, user
|
||||
|
||||
export const useUser = () => useState<UserModel | undefined | null>(undefined);
|
||||
export const updateUser = async () => {
|
||||
const user = useUser();
|
||||
if (user.value === null) return;
|
||||
|
||||
user.value = await $dropFetch<UserModel | null>("/api/v1/user");
|
||||
};
|
||||
Reference in New Issue
Block a user