Skip to content

Commit

Permalink
Empty data fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rupali-inflection committed Dec 16, 2024
1 parent a4dd237 commit 8effefd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/routes/users/[userId]/notifications/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@

<script lang="ts">
import { enhance } from '$app/forms';
import { afterNavigate } from '$app/navigation';
import { page } from '$app/stores';
import BreadCrumbs from '$lib/components/breadcrumbs/breadcrums.svelte';
import { NotificationTopics, NotificationTypes } from '$lib/types/notification.topics.js';
Expand All @@ -237,6 +238,21 @@
// { name: 'Create', path: createRoute }
];
let topic: string, title: string, body: string, url: string;
const init = () => {
topic = 'All_Users';
title = '';
body = '';
url = '';
}
init();
afterNavigate(({from, to}) => {
init();
});
</script>

<BreadCrumbs crumbs={breadCrumbs} />
Expand Down Expand Up @@ -272,6 +288,7 @@
class="select w-full"
name="topic"
placeholder="Select topic here..."
bind:value={topic}
>
{#each Object.entries(NotificationTopics) as [key, value]}
<option
Expand All @@ -289,6 +306,7 @@
type="text"
name="title"
required
bind:value={title}
placeholder="Enter title here..."
class="input w-full {form?.errors?.title ? 'border-error-300 text-error-500' : ''}"
minlength="2"
Expand All @@ -307,6 +325,7 @@
placeholder="Enter body here..."
class="textarea"
required
bind:value={body}
minlength="2"
maxlength="150"
/>
Expand All @@ -329,6 +348,7 @@
type="url"
name="url"
class="input w-full"
bind:value={url}
/>
</td>
</tr>
Expand Down

0 comments on commit 8effefd

Please sign in to comment.