mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
feat: refactor news and migrate rest of useFetch to $dropFetch
This commit is contained in:
@ -6,11 +6,10 @@ import type { User } from "@prisma/client";
|
||||
|
||||
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 $dropFetch<User | null>("/api/v1/user", { headers });
|
||||
user.value = await $dropFetch<User | null>("/api/v1/user");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user