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
+4
View File
@@ -365,3 +365,7 @@ i.x-status-icon.red {
.force-pointer-on-hover input[type='submit'] { .force-pointer-on-hover input[type='submit'] {
cursor: pointer !important; cursor: pointer !important;
} }
[data-sonner-toast] [data-content] [data-description] {
white-space: pre-line;
}
+4 -12
View File
@@ -4,10 +4,8 @@ import Noty from 'noty';
import { import {
useAuthStore, useAuthStore,
useAvatarStore,
useModalStore, useModalStore,
useNotificationStore, useNotificationStore,
useUiStore,
useUpdateLoopStore, useUpdateLoopStore,
useUserStore useUserStore
} from '../stores'; } from '../stores';
@@ -32,12 +30,10 @@ const t = i18n.global.t;
*/ */
export function request(endpoint, options) { export function request(endpoint, options) {
const userStore = useUserStore(); const userStore = useUserStore();
const avatarStore = useAvatarStore();
const authStore = useAuthStore(); const authStore = useAuthStore();
const modalStore = useModalStore(); const modalStore = useModalStore();
const notificationStore = useNotificationStore(); const notificationStore = useNotificationStore();
const updateLoopStore = useUpdateLoopStore(); const updateLoopStore = useUpdateLoopStore();
const uiStore = useUiStore();
if ( if (
!watchState.isLoggedIn && !watchState.isLoggedIn &&
endpoint.startsWith('/auth') && endpoint.startsWith('/auth') &&
@@ -319,17 +315,13 @@ export function $throw(code, error, endpoint) {
if (endpoint?.endsWith('/mutuals') && (code === 403 || code === -1)) { if (endpoint?.endsWith('/mutuals') && (code === 403 || code === -1)) {
ignoreError = true; 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 (text.length && !ignoreError) {
if (AppDebug.errorNoty) { toast.error(message[0], {
AppDebug.errorNoty.close(); description: message.slice(1).join('\n'),
} position: 'bottom-left'
AppDebug.errorNoty = new Noty({
type: 'error',
text
}); });
AppDebug.errorNoty.show();
} }
const e = new Error(text); const e = new Error(text);
e.status = code; e.status = code;