1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

refactor: Demo server, prohibit operation (#7433)

This commit is contained in:
2024-12-19 10:06:19 +08:00 committed by GitHub
parent 063a071228
commit 956d47f9da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 39 additions and 37 deletions

View File

@ -130,7 +130,7 @@ class RequestHttp {
response.status, response.status,
response.data && response.data['message'] ? response.data['message'] : '', response.data && response.data['message'] ? response.data['message'] : '',
); );
return; return Promise.reject(error);
default: default:
globalStore.isLogin = false; globalStore.isLogin = false;
globalStore.errStatus = 'code-' + response.status; globalStore.errStatus = 'code-' + response.status;

View File

@ -438,13 +438,7 @@ const onChangeThemeColor = () => {
themeColorRef.value.acceptParams({ themeColor: themeColor, theme: globalStore.themeConfig.theme }); themeColorRef.value.acceptParams({ themeColor: themeColor, theme: globalStore.themeConfig.theme });
}; };
const onSave = async (key: string, val: any) => { const handleThemeChange = async (val: string) => {
loading.value = true;
if (key === 'Language') {
i18n.locale.value = val;
globalStore.updateLanguage(val);
}
if (key === 'Theme') {
globalStore.themeConfig.theme = val; globalStore.themeConfig.theme = val;
switchTheme(); switchTheme();
if (globalStore.isProductPro) { if (globalStore.isProductPro) {
@ -460,26 +454,34 @@ const onSave = async (key: string, val: any) => {
globalStore.themeConfig.primary = color; globalStore.themeConfig.primary = color;
setPrimaryColor(color); setPrimaryColor(color);
} }
} };
if (key === 'MenuTabs') {
globalStore.setOpenMenuTabs(val === 'enable'); const onSave = async (key: string, val: any) => {
} loading.value = true;
let param = { let param = {
key: key, key: key,
value: val + '', value: val + '',
}; };
await updateSetting(param) try {
.then(async () => { await updateSetting(param);
if (param.key === 'Language') { if (key === 'Language') {
i18n.locale.value = val;
globalStore.updateLanguage(val);
location.reload(); location.reload();
} }
loading.value = false;
if (key === 'Theme') {
await handleThemeChange(val);
}
if (key === 'MenuTabs') {
globalStore.setOpenMenuTabs(val === 'enable');
}
MsgSuccess(i18n.t('commons.msg.operationSuccess')); MsgSuccess(i18n.t('commons.msg.operationSuccess'));
await search(); await search();
}) } catch (error) {
.catch(() => { } finally {
loading.value = false; loading.value = false;
}); }
}; };
onMounted(() => { onMounted(() => {