Merge pull request #80 from HTWK-Leipzig/79-edit-calender-loading-block

fix:#79 added check for token and response feedback with toast
This commit is contained in:
masterElmar
2023-11-20 22:36:15 +01:00
committed by GitHub
4 changed files with 28 additions and 14 deletions

View File

@@ -46,14 +46,22 @@ function loadCalendar(): void {
moduleStore().removeAllModules();
tokenStore().setToken(token.value);
getCalender(token.value).then((data) => {
data.forEach((module) => {
moduleStore().addModule(module);
});
modules.value = data;
getCalender(token.value).then((data: Module[]) => {
if (data.length > 0) {
data.forEach((module) => {
moduleStore().addModule(module);
});
modules.value = data;
router.push("/edit-additional-modules");
} else {
toast.add({
severity: "error",
summary: t("editCalendarView.error"),
detail: t("editCalendarView.noCalendarFound"),
life: 3000,
});
}
});
router.push("/edit-additional-modules");
}
</script>