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">
|
<script setup lang="ts">
|
||||||
import { defineComponent, onMounted } from 'vue';
|
import { defineComponent, onMounted } from 'vue';
|
||||||
import { useAuthStore } from './stores/auth';
|
import { useAuthStore } from './stores/auth';
|
||||||
import { useBoatStore } from './stores/boat';
|
|
||||||
import { useReservationStore } from './stores/reservation';
|
|
||||||
|
|
||||||
defineComponent({
|
defineComponent({
|
||||||
name: 'OYS Borrow-a-Boat',
|
name: 'OYS Borrow-a-Boat',
|
||||||
@@ -14,7 +12,5 @@ defineComponent({
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await useAuthStore().init();
|
await useAuthStore().init();
|
||||||
await useBoatStore().fetchBoats();
|
|
||||||
await useReservationStore().fetchUserReservations();
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ import DiscordOauthComponent from 'src/components/DiscordOauthComponent.vue';
|
|||||||
const email = ref('');
|
const email = ref('');
|
||||||
const password = ref('');
|
const password = ref('');
|
||||||
|
|
||||||
console.log('version: process.env.VUE_APP_VERSION');
|
console.log('version:' + process.env.VUE_APP_VERSION);
|
||||||
|
|
||||||
const doLogin = async () => {
|
const doLogin = async () => {
|
||||||
login(email.value, password.value);
|
login(email.value, password.value);
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { defineStore } from 'pinia';
|
|||||||
import { ID, account, functions, teams } from 'boot/appwrite';
|
import { ID, account, functions, teams } from 'boot/appwrite';
|
||||||
import { ExecutionMethod, OAuthProvider, type Models } from 'appwrite';
|
import { ExecutionMethod, OAuthProvider, type Models } from 'appwrite';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
|
import { useBoatStore } from './boat';
|
||||||
|
import { useReservationStore } from './reservation';
|
||||||
|
|
||||||
export const useAuthStore = defineStore('auth', () => {
|
export const useAuthStore = defineStore('auth', () => {
|
||||||
const currentUser = ref<Models.User<Models.Preferences> | null>(null);
|
const currentUser = ref<Models.User<Models.Preferences> | null>(null);
|
||||||
@@ -14,6 +16,8 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
try {
|
try {
|
||||||
currentUser.value = await account.get();
|
currentUser.value = await account.get();
|
||||||
currentUserTeams.value = await teams.list();
|
currentUserTeams.value = await teams.list();
|
||||||
|
await useBoatStore().fetchBoats();
|
||||||
|
await useReservationStore().fetchUserReservations();
|
||||||
} catch {
|
} catch {
|
||||||
currentUser.value = null;
|
currentUser.value = null;
|
||||||
currentUserTeams.value = null;
|
currentUserTeams.value = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user