reuse register toast id

This commit is contained in:
2025-08-29 16:16:57 +02:00
parent 0f57799aaf
commit 8bf6de1682

View File

@@ -1,6 +1,8 @@
import { toast } from 'vue-sonner';
import type { ApiResponse } from '#shared/types/api';
const REGISTER_TOAST_ID = 'REGISTER_USER_TOAST' as const;
export async function registerUser(
username: string,
email: string,
@@ -24,6 +26,7 @@ export async function registerUser(
if (data.value == null) {
toast.error('Register', {
id: REGISTER_TOAST_ID,
description: error.value?.data ?? 'Failed to register',
});
@@ -33,6 +36,7 @@ export async function registerUser(
}
toast.success('Register', {
id: REGISTER_TOAST_ID,
description: `Successfully registered user ${username}`,
});