feat:#19 added toast for too many requests

This commit is contained in:
Elmar Kresse
2024-02-21 02:40:18 +01:00
parent 475b5f9ce0
commit cd7b00f997
4 changed files with 43 additions and 20 deletions

View File

@@ -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>