196196<script lang="ts" setup>
197197import { ref , reactive , onMounted , computed } from ' vue' ;
198198import { ElForm , ElMessageBox } from ' element-plus' ;
199- import { getSettingInfo , updateSetting , getSystemAvailable } from ' @/api/modules/setting' ;
199+ import { getSettingInfo , updateSetting , getSystemAvailable , updateApiConfig } from ' @/api/modules/setting' ;
200200import { GlobalStore } from ' @/store' ;
201201import { useI18n } from ' vue-i18n' ;
202202import { useTheme } from ' @/hooks/use-theme' ;
@@ -391,19 +391,11 @@ const onChangeProxy = () => {
391391
392392const onChangeApiInterfaceStatus = async () => {
393393 if (form .apiInterfaceStatus === ' enable' ) {
394- loading .value = true ;
395- await updateSetting ({ key: ' ApiInterfaceStatus' , value: form .apiInterfaceStatus })
396- .then (() => {
397- loading .value = false ;
398- apiInterfaceRef .value .acceptParams ({
399- apiInterfaceStatus: form .apiInterfaceStatus ,
400- apiKey: form .apiKey ,
401- ipWhiteList: form .ipWhiteList ,
402- });
403- })
404- .catch (() => {
405- loading .value = false ;
406- });
394+ apiInterfaceRef .value .acceptParams ({
395+ apiInterfaceStatus: form .apiInterfaceStatus ,
396+ apiKey: form .apiKey ,
397+ ipWhiteList: form .ipWhiteList ,
398+ });
407399 return ;
408400 }
409401 ElMessageBox .confirm (i18n .t (' setting.apiInterfaceClose' ), i18n .t (' setting.apiInterface' ), {
@@ -413,7 +405,12 @@ const onChangeApiInterfaceStatus = async () => {
413405 .then (async () => {
414406 loading .value = true ;
415407 form .apiInterfaceStatus = ' disable' ;
416- await updateSetting ({ key: ' ApiInterfaceStatus' , value: ' disable' })
408+ let param = {
409+ apiKey: form .apiKey ,
410+ ipWhiteList: form .ipWhiteList ,
411+ apiInterfaceStatus: form .apiInterfaceStatus ,
412+ };
413+ await updateApiConfig (param )
417414 .then (() => {
418415 loading .value = false ;
419416 search ();
0 commit comments