mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 14:46:04 +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'] {
|
.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
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user