1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 00:09:16 +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.data && response.data['message'] ? response.data['message'] : '',
);
return;
return Promise.reject(error);
default:
globalStore.isLogin = false;
globalStore.errStatus = 'code-' + response.status;

View File

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