(null);
async function deleteSurvey() {
await fetch('', {
@@ -50,7 +56,7 @@
+ {#if participant.answers.length > 0}
+
+ {/if}
{/each}
@@ -92,20 +111,27 @@
-
+
+ Are you sure you want to delete the survey.
+ This action cannot be undone.
+
+
+ {}} bind:dialogRef={deleteAnswersDialogRef}>
+
+ {#snippet buttons()}
+
+
+
+
+ {/snippet}
+
diff --git a/src/routes/[accessToken]/+page.server.ts b/src/routes/[accessToken]/+page.server.ts
index 3c9de58..42a1db8 100644
--- a/src/routes/[accessToken]/+page.server.ts
+++ b/src/routes/[accessToken]/+page.server.ts
@@ -24,7 +24,7 @@ export const load: PageServerLoad = async ({ params, url }) => {
if (await db.$count(surveyAnswersTable, eq(surveyAnswersTable.participantId, results[0].survey_access_table.id)) > 0) {
log_load('Answers already submitted: %s', params.accessToken);
- error(400, 'Answers already submitted');
+ error(400, 'You have already submitted your answers. If you feel that this is wrong, please contact the survey creator to reset your answers.');
}
const survey = results[0].surveys_table;
@@ -57,7 +57,7 @@ export const actions = {
if (await db.$count(surveyAnswersTable, eq(surveyAnswersTable.participantId, results[0].survey_access_table.id)) > 0) {
log_store('Answers already submitted: %s', params.accessToken);
- error(400, 'Answers already submitted');
+ error(400, 'You have already submitted your answers. If you feel that this is wrong, please contact the survey creator to reset your answers.');
}
const survey = results[0].surveys_table;