mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-18 10:41:11 +10:00
26 lines
700 B
TypeScript
26 lines
700 B
TypeScript
import type { SerializeObject } from "nitropack";
|
|
import type { UserModel } from "~~/prisma/client/models";
|
|
import type { AuthMec } from "~~/prisma/client/enums";
|
|
|
|
export const useUsers = () =>
|
|
useState<
|
|
| Array<
|
|
SerializeObject<
|
|
UserModel & {
|
|
authMecs?: Array<{ id: string; mec: AuthMec }>;
|
|
}
|
|
>
|
|
>
|
|
| undefined
|
|
>("users", () => undefined);
|
|
|
|
export const fetchUsers = async () => {
|
|
const users = useUsers();
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
// @ts-ignore forget why this ignor exists
|
|
const newValue: User[] = await $dropFetch("/api/v1/admin/users");
|
|
users.value = newValue;
|
|
return newValue;
|
|
};
|