Skip to content

Commit

Permalink
Merge pull request #2 from probablyjassin:dev
Browse files Browse the repository at this point in the history
Merge dev
  • Loading branch information
probablyjassin authored Oct 15, 2024
2 parents f93b54b + cd135d1 commit f08ec22
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pages/stundenplan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Zurück zu Heute
</UButton>
</span>
<UTable :rows="schedule[page - 1]" class="w-full" />
<UTable :rows="schedule[page - 1]" class="w-full" :loading="!hasLoaded"/>
<button @click="logout()" class="mt-5 p-2 bg-primary text-white rounded">Anmeldedaten zurücksetzen</button>
</div>
</ClientOnly>
Expand All @@ -32,10 +32,12 @@
const today = new Date().setHours(0, 0, 0, 0);
const page = ref(1);
const groupedByDay = ref({});
const data = ref([]);
const groupedByDay = useState('groupedByDay', (() => ({})));
const data = useState('stundenplan', (() => []));
const schedule = computed(() => Object.values(groupedByDay.value));
const hasLoaded = ref(false);
watch(groupedByDay.value, (newVal) => {
const todayIndex = Object.keys(newVal).indexOf(today.toString());
if (todayIndex !== -1) {
Expand All @@ -51,6 +53,8 @@
});
onMounted(async () => {
if (data.value.length !== 0) return;
const response = await $fetch(
`https://corsproxy.io/?https%3A%2F%2Fselfservice.campus-dual.de%2Froom%2Fjson%3Fuserid%3D${username.value}%26hash%3D${password.value}%26t%3D${Math.floor(Date.now() / 1000)}`
);
Expand All @@ -71,6 +75,8 @@
Bemerkungen: item["remarks"] || "---",
});
});
hasLoaded.value = true;
});
function logout() {
Expand Down

0 comments on commit f08ec22

Please sign in to comment.