Skip to content

Commit

Permalink
Adapted the calendar to work with the current API
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Apr 21, 2023
1 parent 2ad0d7a commit 73bc690
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
11 changes: 11 additions & 0 deletions webclient/src/api_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,19 @@ export type components = {
* @example 2018-01-01T00:00:00
*/
readonly last_sync: string;
/**
* @description Link to the same calendar, but in TUMonline
* @example https://campus.tum.de/tumonline/wbKalender.wbRessource?pResNr=12543
*/
readonly calendar_url: string;
};
readonly CalendarEntry: {
/**
* Format: int32
* @description The id of the calendar entry used in TUMonline internally
* @example 42
*/
readonly id: number;
/**
* @description The title of the Entry
* @example Quantenteleportation
Expand Down
12 changes: 6 additions & 6 deletions webclient/src/components/CalendarModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const global = useGlobalStore();
const showDate = ref(new Date());
const tumonlineCalendarUrl = ref("https://campus.tum.de/tumonline");
const lastmod = ref("xx.xx.xxxx xx:xx");
const last_sync = ref("xx.xx.xxxx xx:xx");
const events = ref<ICalendarItem[]>([]);
const route = useRoute();
Expand All @@ -38,17 +38,17 @@ function update() {
useFetch<CalendarResponse>(`/api/calendar/${route.params.id}?start=${startString}&end=${endString}`, (d) => {
console.log(d);
tumonlineCalendarUrl.value = d.calendar_url;
lastmod.value = d.lastmod;
events.value = d.events.map((e) => ({
last_sync.value = d.last_sync;
events.value = d.entries.map((e) => ({
id: e.id,
title: e.title,
startDate: new Date(e.start),
endDate: new Date(e.end),
classes: e.classes,
classes: [e.entry_type],
}));
});
}
function setShowDate(d) {
function setShowDate(d: Date) {
showDate.value = d;
}
</script>
Expand Down Expand Up @@ -78,7 +78,7 @@ function setShowDate(d) {
<div class="modal-footer">
Events are updated daily, if in doubt, please check the
<a v-bind:href="global.calendar.url || 'https://campus.tum.de'">official calendar on TUMonline</a>. <br />
Last update: {{ lastmod }}
Last update: {{ last_sync }}
</div>
</div>
</div>
Expand Down

0 comments on commit 73bc690

Please sign in to comment.