mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
Object storage now works fully, with the permission system. It still needs additional external endpoints for updating and deleting objects from the API, but it is otherwise complete. Further tasks include writing an S3 adapter.
17 lines
458 B
TypeScript
17 lines
458 B
TypeScript
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/user", { headers });
|
|
};
|