replace ElMessageBox(alert, confirm) with alert dialog

This commit is contained in:
pa
2026-01-13 22:40:13 +09:00
committed by Natsumi
parent 870c7a4938
commit fc5afe9e69
53 changed files with 1250 additions and 862 deletions

View File

@@ -1,4 +1,3 @@
import { ElMessageBox } from 'element-plus';
import { toast } from 'vue-sonner';
import Noty from 'noty';
@@ -6,6 +5,7 @@ import Noty from 'noty';
import {
useAuthStore,
useAvatarStore,
useModalStore,
useNotificationStore,
useUpdateLoopStore,
useUserStore
@@ -33,6 +33,7 @@ export function request(endpoint, options) {
const userStore = useUserStore();
const avatarStore = useAvatarStore();
const authStore = useAuthStore();
const modalStore = useModalStore();
const notificationStore = useNotificationStore();
const updateLoopStore = useUpdateLoopStore();
if (
@@ -187,10 +188,10 @@ export function request(endpoint, options) {
}
}
if (status === 403 && endpoint === 'config') {
ElMessageBox.alert(
t('api.error.message.vpn_in_use'),
`403 ${t('api.error.message.login_error')}`
).catch(() => {});
modalStore.alert({
description: t('api.error.message.vpn_in_use'),
title: `403 ${t('api.error.message.login_error')}`
});
authStore.handleLogoutEvent();
$throw(403, endpoint);
}

View File

@@ -1,22 +1,20 @@
import { ElMessageBox } from 'element-plus';
import { openExternalLink } from '../shared/utils';
import { useModalStore } from '../stores';
// requires binding of SQLite
class SQLiteService {
handleSQLiteError(e) {
if (typeof e.message === 'string') {
const modalStore = useModalStore();
if (e.message.includes('database disk image is malformed')) {
ElMessageBox.confirm(
'Please repair or delete your database file by following these instructions.',
'Your database is corrupted',
{
confirmButtonText: 'Confirm',
type: 'warning'
}
)
.then(async (action) => {
if (action !== 'confirm') return;
modalStore
.confirm({
description:
'Please repair or delete your database file by following these instructions.',
title: 'Your database is corrupted'
})
.then(({ ok }) => {
if (!ok) return;
openExternalLink(
'https://github.com/vrcx-team/VRCX/wiki#how-to-repair-vrcx-database'
);
@@ -24,37 +22,26 @@ class SQLiteService {
.catch(() => {});
}
if (e.message.includes('database or disk is full')) {
ElMessageBox.alert(
'Please free up some disk space.',
'Disk containing database is full',
{
confirmButtonText: 'OK',
type: 'warning'
}
).catch(() => {});
modalStore.alert({
description: 'Please free up some disk space.',
title: 'Disk containing database is full'
});
}
if (
e.message.includes('database is locked') ||
e.message.includes('attempt to write a readonly database')
) {
ElMessageBox.alert(
'Please close other applications that might be using the database file.',
'Database is locked',
{
confirmButtonText: 'OK',
type: 'warning'
}
).catch(() => {});
modalStore.alert({
description:
'Please close other applications that might be using the database file.',
title: 'Database is locked'
});
}
if (e.message.includes('disk I/O error')) {
ElMessageBox.alert(
'Please check your disk for errors.',
'Disk I/O error',
{
confirmButtonText: 'OK',
type: 'warning'
}
).catch(() => {});
modalStore.alert({
description: 'Please check your disk for errors.',
title: 'Disk I/O error'
});
}
}
throw e;