This commit is contained in:
2026-03-30 11:08:25 +08:00
parent ae315100b4
commit 1fe4a4fb41
10 changed files with 5524 additions and 138 deletions

View File

@@ -9,7 +9,7 @@ import type {
} from "./models/AntiForgeryToken";
class AxiosHelper {
private readonly REFRESH_TOKEN_URL: string = "/common/refreshtoken";
private readonly REFRESH_TOKEN_URL: string = "/user/refreshtoken";
private constructor(config?: CreateAxiosDefaults) {
this.axios = Axios.create({
withCredentials: true,

View File

@@ -36,6 +36,14 @@ export const editUser = async (
return await AxiosHelper.getInstance().post("/user/edit", params);
};
export const signOut = async (): Promise<M.ApiResponseMessage> => {
return await AxiosHelper.getInstance().post("/user/signout");
};
export const refreshToken = async (): Promise<M.AccessTokenResponse> => {
return await AxiosHelper.getInstance().post("/user/refreshtoken");
};
//district
export const districtTop3Levels = async (): Promise<M.DistrictsResponse> => {
return await AxiosHelper.getInstance().get("/district/top3level");
@@ -67,14 +75,6 @@ export const csrfToken = async (): Promise<M.AntiForgeryTokenResponse> => {
return csrfResult;
};
export const signOut = async (): Promise<M.ApiResponseMessage> => {
return await AxiosHelper.getInstance().post("/common/signout");
};
export const refreshToken = async (): Promise<M.AccessTokenResponse> => {
return await AxiosHelper.getInstance().post("/common/refreshtoken");
};
//category
export const getCategoryTree = async (): Promise<M.CategoryListResponse> => {
return await AxiosHelper.getInstance().get("/category/list");
@@ -83,6 +83,12 @@ export const getCategoryTree = async (): Promise<M.CategoryListResponse> => {
//product
export const productSearch = async (
params: M.ProductSearchParms,
): Promise<M.ProductSearchResponse> => {
return await AxiosHelper.getInstance().get("/product/search", params);
};
export const productList = async (
params: M.ProductSearchParms,
): Promise<M.ProductSearchResponse> => {
return await AxiosHelper.getInstance().get("/product/list", params);
};

View File

@@ -164,7 +164,7 @@
font-weight: 600;
}
&:nth-last-of-type() {
&:nth-last-of-type {
border-bottom: none;
}
}

View File

@@ -11,7 +11,7 @@ import { productReducer, initialState } from "../../store/product";
import * as actions from "../../store/product/action";
import {
getCategoryTree,
productSearch,
productList,
productDetail,
productDelete,
productEdit,
@@ -75,7 +75,7 @@ export function Component() {
orderBys.push(ProductOrderBys.CreateTime);
else orderBys.push(ProductOrderBys.CreateTimeDesc);
const result = await productSearch({
const result = await productList({
categoryId: states.categoryId,
keyword: states.keyword,
orderBys: orderBys,

View File

@@ -1,5 +1,6 @@
import { type SignInState } from "./state";
import { type SignInAction } from "./action";
import { UserRoles } from "../../api/models";
export const initialState: SignInState = {
isSubmiting: false,
@@ -9,7 +10,7 @@ export const initialState: SignInState = {
},
signUpUser: {
account: "",
defaultRole: "Buyer",
defaultRole: UserRoles.Buyer,
nickName: "",
password: "",
},