|
@@ -24,17 +24,19 @@ export const passWordEditAPI = (data: any) => {
|
|
|
export const getDictListAPI = () => {
|
|
|
return async (dispatch: AppDispatch) => {
|
|
|
const res = await http.get("cms/dict/getList");
|
|
|
- const list: DictListTypeAPI[] = res.data;
|
|
|
- const obj = {
|
|
|
- age: [{ label: "全部", value: "", type: "age" }],
|
|
|
- texture: [{ label: "全部", value: "", type: "texture" }],
|
|
|
- level: [{ label: "全部", value: "", type: "level" }],
|
|
|
- source: [{ label: "全部", value: "", type: "source" }],
|
|
|
- } as DictListTypeObj;
|
|
|
- list.forEach((v) => {
|
|
|
- obj[v.type].push({ label: v.name, value: v.name, type: v.type });
|
|
|
- });
|
|
|
+ if (res.code === 0) {
|
|
|
+ const list: DictListTypeAPI[] = res.data;
|
|
|
+ const obj = {
|
|
|
+ age: [{ label: "全部", value: "", type: "age" }],
|
|
|
+ texture: [{ label: "全部", value: "", type: "texture" }],
|
|
|
+ level: [{ label: "全部", value: "", type: "level" }],
|
|
|
+ source: [{ label: "全部", value: "", type: "source" }],
|
|
|
+ } as DictListTypeObj;
|
|
|
+ list.forEach((v) => {
|
|
|
+ obj[v.type].push({ label: v.name, value: v.name, type: v.type });
|
|
|
+ });
|
|
|
|
|
|
- dispatch({ type: "login/getDictList", payload: obj });
|
|
|
+ dispatch({ type: "login/getDictList", payload: obj });
|
|
|
+ }
|
|
|
};
|
|
|
};
|