mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2026-01-17 13:42:25 +01:00
feat:#19 added toast for too many requests
This commit is contained in:
@@ -8,6 +8,7 @@ import ModuleTemplateDialog from "./ModuleTemplateDialog.vue";
|
||||
import { onlyWhitespace } from "../helpers/strings.ts";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { Module } from "@/model/module.ts";
|
||||
import { useToast } from "primevue/usetoast";
|
||||
const { t } = useI18n({ useScope: "global" });
|
||||
|
||||
const store = moduleStore();
|
||||
@@ -33,10 +34,26 @@ const columns = computed(() => [
|
||||
{ field: "Reminder", header: t("renameModules.reminder") },
|
||||
]);
|
||||
|
||||
const toast = useToast();
|
||||
|
||||
async function finalStep() {
|
||||
const token: string = await createIndividualFeed(store.getAllModules());
|
||||
tokenStore().setToken(token);
|
||||
await router.push("/calendar-link");
|
||||
const createFeed: Promise<string>= createIndividualFeed(store.getAllModules());
|
||||
|
||||
// Check if createFeed Promise is resolved
|
||||
createFeed.then(async (token: string) => {
|
||||
tokenStore().setToken(token);
|
||||
await router.push("/calendar-link");
|
||||
});
|
||||
|
||||
// if createFeed Promise is rejected
|
||||
createFeed.catch(() => {
|
||||
toast.add({
|
||||
severity: "error",
|
||||
summary: t("renameModules.error"),
|
||||
detail: t("renameModules.TooManyRequests"),
|
||||
life: 3000,
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user