Files
front/stores/authStore.ts
T
2024-06-13 09:46:40 -04:00

20 lines
484 B
TypeScript

import { defineStore } from "pinia";
import { whoami } from "~/netcode";
export const useAuthStore = defineStore("auth", {
state: () => ({
selfUser: {} as { userId?: string; image?: string; username?: string },
logged: false,
}),
actions: {
async whoami() {
const data = await whoami();
Object.assign(this.selfUser, data.value);
this.logged = true;
},
oauth2_register_discord: () => {
throw Error("not implemented");
},
},
});