fix: 状态码使用常量避免后续变更

This commit is contained in:
TsMask
2023-09-14 15:19:37 +08:00
parent 9a88d9b8de
commit 03e1b4b8bd
18 changed files with 120 additions and 78 deletions

View File

@@ -14,6 +14,7 @@ import {
MENU_COMPONENT_LAYOUT_BLANK,
MENU_COMPONENT_LAYOUT_LINK,
} from '@/constants/menu-constants';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
/**路由构建参数类型 */
type RouterStore = {
@@ -46,7 +47,7 @@ const useRouterStore = defineStore('router', {
*/
async generateRoutes() {
const res = await getRouters();
if (res.code === 1 && Array.isArray(res.data)) {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
const buildRoutes = buildRouters(res.data.concat());
this.buildRouterData = buildRoutes;
return buildRoutes;