mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 22:33:50 +02:00
migrate error notifications from Noty to a toast
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user