fix: 请求结果msg取多语言

This commit is contained in:
TsMask
2023-11-22 19:33:46 +08:00
parent 6ada29bc9b
commit 12499e78ea
8 changed files with 31 additions and 30 deletions

View File

@@ -4,7 +4,7 @@ import {
RESULT_MSG_ERROR,
RESULT_MSG_SUCCESS,
} from '@/constants/result-constants';
import { request } from '@/plugins/http-fetch';
import { language, request } from '@/plugins/http-fetch';
import { parseObjLineToHump } from '@/utils/parse-utils';
/**
@@ -63,7 +63,7 @@ export async function getAlarmSet() {
}
}
if (Object.keys(resultData).length === 0) {
return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR, data: {} };
return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR[language], data: {} };
}
return {
code: RESULT_CODE_SUCCESS,
@@ -117,7 +117,7 @@ export async function updateAlarmSet(data: Record<string, any>) {
}
// 无变更时
if (resultNum === 0) {
return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR, data: 0 };
return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR[language], data: 0 };
}
return {
code: RESULT_CODE_SUCCESS,
@@ -183,7 +183,7 @@ export async function updateForwardSet(data: Record<string, any>) {
delete result.data;
return result;
} else {
return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR };
return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR[language] };
}
}
return result;