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