fix: application set language error
Some checks failed
sync2gitee / repo-sync (push) Has been cancelled
Typos Check / Spell Check with Typos (push) Has been cancelled

This commit is contained in:
wxg0103 2025-02-13 11:44:52 +08:00 committed by wxg
parent c59a19bbcb
commit 20260df9a1
2 changed files with 6 additions and 8 deletions

View File

@ -374,6 +374,8 @@ class ApplicationSerializer(serializers.Serializer):
application_access_token.show_source = instance.get('show_source')
if 'language' in instance and instance.get('language') is not None:
application_access_token.language = instance.get('language')
if 'language' not in instance or instance.get('language') is None:
application_access_token.language = None
application_access_token.save()
application_setting_model = DBModelManage.get_model('application_setting')
xpack_cache = DBModelManage.get_model('xpack_cache')

View File

@ -60,7 +60,7 @@ const emit = defineEmits(['refresh'])
const displayFormRef = ref()
const form = ref<any>({
show_source: false,
language: '',
language: ''
})
const detail = ref<any>(null)
@ -72,14 +72,14 @@ watch(dialogVisible, (bool) => {
if (!bool) {
form.value = {
show_source: false,
language: '',
language: ''
}
}
})
const open = (data: any, content: any) => {
detail.value = content
form.value.show_source = data.show_source
form.value.language = data.language || getBrowserLang()
form.value.language = data.language
dialogVisible.value = true
}
@ -87,11 +87,7 @@ const submit = async (formEl: FormInstance | undefined) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
const obj = {
show_source: form.value.show_source,
language: form.value.language
}
applicationApi.putAccessToken(id as string, obj, loading).then((res) => {
applicationApi.putAccessToken(id as string, form.value, loading).then((res) => {
emit('refresh')
// @ts-ignore
MsgSuccess(t('common.settingSuccess'))