migrate error notifications from Noty to a toast

This commit is contained in:
pa
2026-02-23 15:28:59 +09:00
committed by Natsumi
parent b5b5776275
commit 49d8f1c60b
2 changed files with 8 additions and 12 deletions

View File

@@ -365,3 +365,7 @@ i.x-status-icon.red {
.force-pointer-on-hover input[type='submit'] {
cursor: pointer !important;
}
[data-sonner-toast] [data-content] [data-description] {
white-space: pre-line;
}

View File

@@ -4,10 +4,8 @@ import Noty from 'noty';
import {
useAuthStore,
useAvatarStore,
useModalStore,
useNotificationStore,
useUiStore,
useUpdateLoopStore,
useUserStore
} from '../stores';
@@ -32,12 +30,10 @@ const t = i18n.global.t;
*/
export function request(endpoint, options) {
const userStore = useUserStore();
const avatarStore = useAvatarStore();
const authStore = useAuthStore();
const modalStore = useModalStore();
const notificationStore = useNotificationStore();
const updateLoopStore = useUpdateLoopStore();
const uiStore = useUiStore();
if (
!watchState.isLoggedIn &&
endpoint.startsWith('/auth') &&
@@ -319,17 +315,13 @@ export function $throw(code, error, endpoint) {
if (endpoint?.endsWith('/mutuals') && (code === 403 || code === -1)) {
ignoreError = true;
}
const text = message.map((s) => escapeTag(s)).join('<br>');
const text = message.map((s) => escapeTag(s)).join('\n');
if (text.length && !ignoreError) {
if (AppDebug.errorNoty) {
AppDebug.errorNoty.close();
}
AppDebug.errorNoty = new Noty({
type: 'error',
text
toast.error(message[0], {
description: message.slice(1).join('\n'),
position: 'bottom-left'
});
AppDebug.errorNoty.show();
}
const e = new Error(text);
e.status = code;