Chore : attempt to reduce loading times
release-tag / release-image (push) Successful in 51s

This commit is contained in:
2024-07-31 10:20:48 +02:00
parent cfbaeca52b
commit 0669619543
9 changed files with 569 additions and 593 deletions
+6 -5
View File
@@ -25,25 +25,26 @@ export async function getLobby() {
export async function whoami() {
const config = useRuntimeConfig();
const { data, pending, error, refresh } = await useFetch<User>(
const req = await useFetch<User>(
config.public.endpoint + "/whoami",
{
credentials: "include",
server: false,
}
);
if (error.value?.statusCode && [401].includes(error.value.statusCode)) {
await req.execute();
if (req.error.value && req.error.value.statusCode == 401) {
// await navigateTo(config.public.discordLoginEndpoint, {
// external: true,
// });
throw new Error("You are not logged in");
}
if (error.value) {
if (req.error.value) {
throw new Error(
"Something went wrong while trying to get user information"
);
}
return data;
return req.data;
}
export async function createGame() {