chore: set toast color (#326)
This commit is contained in:
@@ -84,7 +84,8 @@ export default function AdminPage({ messages, locale }: Props) {
|
||||
const data = await updateUserRole(tokenContext.token.access_token, userEdit.id, role);
|
||||
if (data.user) {
|
||||
addToast({
|
||||
title: 'Info',
|
||||
title: 'Success',
|
||||
color: 'success',
|
||||
description: messages.roleChanged,
|
||||
});
|
||||
setUsers((prevUsers) => {
|
||||
@@ -106,13 +107,16 @@ export default function AdminPage({ messages, locale }: Props) {
|
||||
|
||||
if (data && data.user) {
|
||||
addToast({
|
||||
title: 'Info',
|
||||
title: 'Success',
|
||||
color: 'success',
|
||||
description: messages.lostAdminAuth,
|
||||
});
|
||||
router.push(`/`, { locale: locale });
|
||||
} else {
|
||||
setIsConfirmDialogOpen(false);
|
||||
addToast({
|
||||
title: 'Info',
|
||||
title: 'Error',
|
||||
color: 'danger',
|
||||
description: messages.atLeast,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -273,7 +273,8 @@ export default function CaseEditor({
|
||||
await updateCaseTags(tokenContext.token.access_token, Number(caseId), tagIds, projectId);
|
||||
|
||||
addToast({
|
||||
title: 'Info',
|
||||
title: 'Success',
|
||||
color: 'success',
|
||||
description: messages.updatedTestCase,
|
||||
});
|
||||
setIsDirty(false);
|
||||
|
||||
@@ -192,7 +192,8 @@ export default function RunEditor({
|
||||
await initTestCases();
|
||||
|
||||
addToast({
|
||||
title: 'Info',
|
||||
title: 'Success',
|
||||
color: 'success',
|
||||
description: messages.updatedTestRun,
|
||||
});
|
||||
setIsUpdating(false);
|
||||
|
||||
@@ -71,12 +71,14 @@ export default function ProjectTagsManager({ projectId, messages }: ProjectTagsM
|
||||
setTagName('');
|
||||
addToast({
|
||||
title: 'Success',
|
||||
color: 'success',
|
||||
description: messages.tagCreated,
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : messages.tagErrorCreate;
|
||||
addToast({
|
||||
title: 'Error',
|
||||
color: 'danger',
|
||||
description: errorMessage,
|
||||
});
|
||||
logError('Error creating tag:', error);
|
||||
@@ -97,12 +99,14 @@ export default function ProjectTagsManager({ projectId, messages }: ProjectTagsM
|
||||
setEditErrorMessage('');
|
||||
addToast({
|
||||
title: 'Success',
|
||||
color: 'success',
|
||||
description: messages.tagUpdated,
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : messages.tagErrorUpdate;
|
||||
addToast({
|
||||
title: 'Error',
|
||||
color: 'danger',
|
||||
description: errorMessage,
|
||||
});
|
||||
logError('Error updating tag:', error);
|
||||
@@ -116,12 +120,14 @@ export default function ProjectTagsManager({ projectId, messages }: ProjectTagsM
|
||||
setOpenPopoverTagId(null);
|
||||
addToast({
|
||||
title: 'Success',
|
||||
color: 'success',
|
||||
description: messages.tagDeleted,
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : messages.tagErrorDelete;
|
||||
addToast({
|
||||
title: 'Error',
|
||||
color: 'danger',
|
||||
description: errorMessage,
|
||||
});
|
||||
logError('Error deleting tag:', error);
|
||||
|
||||
@@ -139,7 +139,7 @@ const TokenProvider = ({ toastMessages, locale, children }: TokenProps) => {
|
||||
if (ret.reason === 'notoken') {
|
||||
if (toastMessages) {
|
||||
addToast({
|
||||
title: 'Info',
|
||||
title: 'Error',
|
||||
description: toastMessages.needSignedIn,
|
||||
color: 'danger',
|
||||
});
|
||||
@@ -147,7 +147,7 @@ const TokenProvider = ({ toastMessages, locale, children }: TokenProps) => {
|
||||
} else if (ret.reason === 'expired') {
|
||||
if (toastMessages) {
|
||||
addToast({
|
||||
title: 'Info',
|
||||
title: 'Error',
|
||||
description: toastMessages.sessionExpired,
|
||||
color: 'danger',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user