Add loading spinner

This commit is contained in:
2022-06-02 21:55:59 +02:00
parent bb2891a968
commit 72c8b3adc1
4 changed files with 68 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import { ref, watch } from "vue";
import router from "./router";
export const lastRoute = ref();
export const loading = ref(false);
export const substitutionFilter = ref(
localStorage.getItem("substitutionFilter") || "all"
@ -66,6 +67,8 @@ export const parsedTimetable = computed(() => {
const baseUrl = import.meta.env.VITE_API_ENDPOINT || "/api";
export async function fetchData() {
loading.value = true;
const checkResponse = await fetch(`${baseUrl}/check`);
if (checkResponse.status != 200) router.push("/login");
@ -73,6 +76,8 @@ export async function fetchData() {
fetchTimetable();
fetchSubstitutions();
fetchHistory();
loading.value = false;
}
export async function fetchClassList() {