✨ Replace circular with linear loading indicator
This commit is contained in:
10
src/store.js
10
src/store.js
@ -5,6 +5,7 @@ import i18n from "./main";
|
||||
|
||||
export const lastRoute = ref();
|
||||
export const loading = ref(false);
|
||||
export const loadingProgress = ref(0);
|
||||
|
||||
export const classFilter = ref(localStorage.getItem("classFilter") || "none");
|
||||
export const timetableGroups = ref(
|
||||
@ -45,9 +46,12 @@ if (selectedDay.value == -1)
|
||||
|
||||
// Load new data if date changes
|
||||
watch(selectedDate, async () => {
|
||||
loadingProgress.value = 0.1;
|
||||
loading.value = true;
|
||||
await fetchSubstitutions();
|
||||
loadingProgress.value = 1 / 2;
|
||||
await fetchHistory();
|
||||
loadingProgress.value = 1;
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
@ -124,16 +128,22 @@ export const possibleTimetableGroups = computed(() => {
|
||||
const baseUrl = import.meta.env.VITE_API_ENDPOINT || "/api";
|
||||
|
||||
export async function fetchData() {
|
||||
loadingProgress.value = 0.1;
|
||||
loading.value = true;
|
||||
|
||||
const checkResponse = await fetch(`${baseUrl}/check`);
|
||||
if (checkResponse.status != 200) router.push("/login");
|
||||
loadingProgress.value = 1 / 5;
|
||||
|
||||
await fetchClassList();
|
||||
loadingProgress.value = 2 / 5;
|
||||
await fetchTimetable();
|
||||
loadingProgress.value = 3 / 5;
|
||||
await fetchSubstitutions();
|
||||
loadingProgress.value = 4 / 5;
|
||||
await fetchHistory();
|
||||
|
||||
loadingProgress.value = 1;
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user