Upgrade Quasar
This commit is contained in:
13
src/App.vue
13
src/App.vue
@@ -3,20 +3,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, onMounted } from 'vue';
|
||||
import { useBoatStore } from './stores/boat';
|
||||
import { useScheduleStore } from './stores/schedule';
|
||||
import { useAuthStore } from './stores/auth';
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
defineComponent({
|
||||
name: 'OYS Borrow-a-Boat',
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
if (useAuthStore().currentUser) {
|
||||
await useBoatStore().fetchBoats();
|
||||
await useScheduleStore().fetchTimeBlocks();
|
||||
await useScheduleStore().fetchTimeBlockTemplates();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -55,10 +55,15 @@
|
||||
import {QCalendarScheduler, today} from '@quasar/quasar-ui-qcalendar'
|
||||
import { useBoatStore } from 'src/stores/boat';
|
||||
import { useScheduleStore } from 'src/stores/schedule';
|
||||
import { ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
|
||||
const selectedDate = ref(today())
|
||||
const scheduleStore = useScheduleStore()
|
||||
const resources = useBoatStore().boats
|
||||
const boatStore = useBoatStore()
|
||||
const resources = boatStore.boats
|
||||
const timeblockTemplates = scheduleStore.timeblockTemplates
|
||||
onMounted(async() => {
|
||||
await boatStore.fetchBoats();
|
||||
await scheduleStore.fetchTimeBlockTemplates();
|
||||
await scheduleStore.fetchTimeBlockTemplates()})
|
||||
</script>
|
||||
|
||||
@@ -38,9 +38,6 @@ export default route(function (/* { store, ssrContext } */) {
|
||||
Router.beforeEach((to) => {
|
||||
const auth = useAuthStore();
|
||||
|
||||
if (!auth.ready) {
|
||||
return false;
|
||||
}
|
||||
if (auth.currentUser) {
|
||||
return to.meta.accountRoute ? { name: 'index' } : true;
|
||||
} else {
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ref } from 'vue';
|
||||
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
const currentUser = ref<Models.User<Models.Preferences> | null>(null);
|
||||
const ready = ref(false);
|
||||
|
||||
async function init() {
|
||||
try {
|
||||
@@ -13,7 +12,6 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
} catch {
|
||||
currentUser.value = null;
|
||||
}
|
||||
ready.value = true;
|
||||
}
|
||||
|
||||
async function register(email: string, password: string) {
|
||||
@@ -37,5 +35,5 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
return account.deleteSession('current').then((currentUser.value = null));
|
||||
}
|
||||
|
||||
return { currentUser, register, login, googleLogin, logout, init, ready };
|
||||
return { currentUser, register, login, googleLogin, logout, init };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user