🎨 Run updated prettier
This commit is contained in:
22
src/store.js
22
src/store.js
@ -12,10 +12,10 @@ export const loadingFailed = ref(false);
|
||||
export const classFilter = ref(localStorage.getItem("classFilter") || "none");
|
||||
export const timetableId = ref(localStorage.getItem("timetableId") || "none");
|
||||
export const timetableGroups = ref(
|
||||
JSON.parse(localStorage.getItem("timetableGroups") || "[]")
|
||||
JSON.parse(localStorage.getItem("timetableGroups") || "[]"),
|
||||
);
|
||||
export const localTimetables = ref(
|
||||
JSON.parse(localStorage.getItem("timetables")) || []
|
||||
JSON.parse(localStorage.getItem("timetables")) || [],
|
||||
);
|
||||
|
||||
export const theme = ref(localStorage.getItem("theme") || "auto");
|
||||
@ -32,14 +32,14 @@ watch(
|
||||
(newValue) => {
|
||||
localStorage.setItem("timetableGroups", JSON.stringify(newValue));
|
||||
},
|
||||
{ deep: true }
|
||||
{ deep: true },
|
||||
);
|
||||
watch(
|
||||
localTimetables,
|
||||
(newValue) => {
|
||||
localStorage.setItem("timetables", JSON.stringify(newValue));
|
||||
},
|
||||
{ deep: true }
|
||||
{ deep: true },
|
||||
);
|
||||
watch(theme, (newValue) => {
|
||||
localStorage.setItem("theme", newValue);
|
||||
@ -63,10 +63,10 @@ export const changeDate = ref(new Date());
|
||||
/* Data store */
|
||||
export const timetable = computed(() => {
|
||||
const localTimetable = localTimetables.value.find(
|
||||
(e) => e.id == timetableId.value
|
||||
(e) => e.id == timetableId.value,
|
||||
);
|
||||
const remoteTimetable = timetables.value.find(
|
||||
(e) => e.id == timetableId.value
|
||||
(e) => e.id == timetableId.value,
|
||||
);
|
||||
return (
|
||||
localTimetable || remoteTimetable || { trusted: true, source: "", data: [] }
|
||||
@ -124,7 +124,7 @@ export async function fetchData(days, partial) {
|
||||
|
||||
// Load new data if date changes
|
||||
watch(selectedDate, () =>
|
||||
fetchData(getNextAndPrevDay(selectedDate.value), true)
|
||||
fetchData(getNextAndPrevDay(selectedDate.value), true),
|
||||
);
|
||||
|
||||
export async function fetchSessionInfo() {
|
||||
@ -154,7 +154,7 @@ export async function fetchClassList() {
|
||||
|
||||
export async function fetchTimetables() {
|
||||
const timetableResponse = await fetch(
|
||||
`${baseUrl}/timetable?class=${classFilter.value}`
|
||||
`${baseUrl}/timetable?class=${classFilter.value}`,
|
||||
);
|
||||
const timetableData = await timetableResponse.json();
|
||||
if (timetableData.error) {
|
||||
@ -171,7 +171,7 @@ export async function fetchSubstitutions(day) {
|
||||
const substitutionResponse = await fetch(
|
||||
classFilter.value == "none"
|
||||
? `${baseUrl}/substitutions${requestDate}`
|
||||
: `${baseUrl}/substitutions${requestDate}&class=${classFilter.value}`
|
||||
: `${baseUrl}/substitutions${requestDate}&class=${classFilter.value}`,
|
||||
);
|
||||
const substitutionData = await substitutionResponse.json();
|
||||
substitutions.value[day] = substitutionData;
|
||||
@ -182,7 +182,7 @@ export async function fetchHistory(day) {
|
||||
const historyResponse = await fetch(
|
||||
classFilter.value == "none"
|
||||
? `${baseUrl}/history${requestDate}`
|
||||
: `${baseUrl}/history${requestDate}&class=${classFilter.value}`
|
||||
: `${baseUrl}/history${requestDate}&class=${classFilter.value}`,
|
||||
);
|
||||
const historyData = await historyResponse.json();
|
||||
if (historyData.error) console.warn("API Error: " + historyData.error);
|
||||
@ -201,7 +201,7 @@ export const parsedTimetable = computed(() => {
|
||||
// (timetable groups)
|
||||
if (Array.isArray(lesson) && lesson.length > 1) {
|
||||
let matchingLesson = lesson.find((e) =>
|
||||
timetableGroups.value.includes(e.group)
|
||||
timetableGroups.value.includes(e.group),
|
||||
);
|
||||
// If no valid timetable group is configured
|
||||
// add a dummy lesson showing a notice
|
||||
|
Reference in New Issue
Block a user