Skip to content

Commit

Permalink
put stundenplan data in usestate to prevent refetching
Browse files Browse the repository at this point in the history
  • Loading branch information
probablyjassin committed Oct 15, 2024
1 parent f93b54b commit 29e1213
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pages/stundenplan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
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));
watch(groupedByDay.value, (newVal) => {
Expand All @@ -51,6 +51,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 Down

0 comments on commit 29e1213

Please sign in to comment.