Skip to content

Commit

Permalink
Simplify closing email verification status banner
Browse files Browse the repository at this point in the history
  • Loading branch information
myieye committed Oct 31, 2023
1 parent ad8f7d1 commit 6a9450d
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions frontend/src/lib/email/EmailVerificationStatus.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
import type { LexAuthUser } from '$lib/user';
import { EmailResult } from '.';
import { Button } from '$lib/forms';
import { onDestroy } from 'svelte';
import { Duration } from '$lib/util/time';
import { onNavigate } from '$app/navigation';
export let user: LexAuthUser;
Expand All @@ -30,20 +29,9 @@
}
}
const emailResultUnsubscriber = emailResult.subscribe((result) => {
if (result) {
setTimeout(() => emailResult.set(null), Duration.Medium);
}
});
const requestedEmailUnsubscriber = requestedEmail.subscribe((result) => {
if (result) {
setTimeout(() => requestedEmail.set(null), Duration.Long);
}
});
onDestroy(() => {
emailResultUnsubscriber();
requestedEmailUnsubscriber();
onNavigate(() => {
emailResult.set(null);
requestedEmail.set(null);
});
</script>

Expand Down

0 comments on commit 6a9450d

Please sign in to comment.