Files
front/stores/authStore.ts
T
legonzaur 0669619543
release-tag / release-image (push) Successful in 51s
Chore : attempt to reduce loading times
2024-07-31 10:20:48 +02:00

26 lines
594 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() {
try {
const data = await whoami().then((data) => {
this.logged = true;
return data;
});
Object.assign(this.selfUser, data.value);
} catch (e) { }
},
oauth2_register_discord: () => {
throw Error("not implemented");
},
},
persist: true
});