fix: trying to load resources before auth
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m29s
All checks were successful
Build BAB Application Deployment Artifact / build (push) Successful in 2m29s
This commit is contained in:
@@ -5,8 +5,6 @@
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, onMounted } from 'vue';
|
||||
import { useAuthStore } from './stores/auth';
|
||||
import { useBoatStore } from './stores/boat';
|
||||
import { useReservationStore } from './stores/reservation';
|
||||
|
||||
defineComponent({
|
||||
name: 'OYS Borrow-a-Boat',
|
||||
@@ -14,7 +12,5 @@ defineComponent({
|
||||
|
||||
onMounted(async () => {
|
||||
await useAuthStore().init();
|
||||
await useBoatStore().fetchBoats();
|
||||
await useReservationStore().fetchUserReservations();
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -89,7 +89,7 @@ import DiscordOauthComponent from 'src/components/DiscordOauthComponent.vue';
|
||||
const email = ref('');
|
||||
const password = ref('');
|
||||
|
||||
console.log('version: process.env.VUE_APP_VERSION');
|
||||
console.log('version:' + process.env.VUE_APP_VERSION);
|
||||
|
||||
const doLogin = async () => {
|
||||
login(email.value, password.value);
|
||||
|
||||
@@ -2,6 +2,8 @@ import { defineStore } from 'pinia';
|
||||
import { ID, account, functions, teams } from 'boot/appwrite';
|
||||
import { ExecutionMethod, OAuthProvider, type Models } from 'appwrite';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useBoatStore } from './boat';
|
||||
import { useReservationStore } from './reservation';
|
||||
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
const currentUser = ref<Models.User<Models.Preferences> | null>(null);
|
||||
@@ -14,6 +16,8 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
try {
|
||||
currentUser.value = await account.get();
|
||||
currentUserTeams.value = await teams.list();
|
||||
await useBoatStore().fetchBoats();
|
||||
await useReservationStore().fetchUserReservations();
|
||||
} catch {
|
||||
currentUser.value = null;
|
||||
currentUserTeams.value = null;
|
||||
|
||||
Reference in New Issue
Block a user