diff --git a/atsebayt/src/components/SurveyAdmin.svelte b/atsebayt/src/components/SurveyAdmin.svelte index 0ab89cc..c0148e5 100644 --- a/atsebayt/src/components/SurveyAdmin.svelte +++ b/atsebayt/src/components/SurveyAdmin.svelte @@ -3,6 +3,7 @@ import { goto } from '$app/navigation'; import { getQuestions } from '../lib/questions'; + import { ToastsStore } from '../stores/toasts'; const dispatch = createEventDispatcher(); export let survey = null; @@ -11,7 +12,9 @@ survey.save().then((response) => { dispatch('saved'); }, (error) => { - console.log(error) + ToastsStore.addErrorToast({ + msg: error.errmsg, + }); }) } @@ -19,7 +22,9 @@ survey.delete().then((response) => { goto(`surveys`); }, (error) => { - console.log(error) + ToastsStore.addErrorToast({ + msg: error.errmsg, + }); }) } @@ -27,7 +32,9 @@ survey.duplicate().then((response) => { goto(`surveys/${response.id}`); }).catch((error) => { - console.log(error) + ToastsStore.addErrorToast({ + msg: error.errmsg, + }); }) } diff --git a/atsebayt/src/components/SurveyQuestions.svelte b/atsebayt/src/components/SurveyQuestions.svelte index a906418..1051e60 100644 --- a/atsebayt/src/components/SurveyQuestions.svelte +++ b/atsebayt/src/components/SurveyQuestions.svelte @@ -1,5 +1,6 @@ + +
+ {#each $ToastsStore.toasts as toast} + + {/each} +
diff --git a/atsebayt/src/routes/__layout.svelte b/atsebayt/src/routes/__layout.svelte index db852dc..df45380 100644 --- a/atsebayt/src/routes/__layout.svelte +++ b/atsebayt/src/routes/__layout.svelte @@ -42,6 +42,8 @@