Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对接后端 v5 API #204

Closed
TechQuery opened this issue Nov 27, 2023 · 3 comments · Fixed by #213 or #214 · May be fixed by #209
Closed

对接后端 v5 API #204

TechQuery opened this issue Nov 27, 2023 · 3 comments · Fixed by #213 or #214 · May be fixed by #209
Assignees
Labels
feature New feature or request

Comments

@TechQuery
Copy link
Member

TechQuery commented Nov 27, 2023

核心需求

后端接口封装包 mobx-restful 替换为 mobx-strapi

接口文档

https://hackathon-server.kaiyuanshe.cn/documentation

@TechQuery TechQuery added the feature New feature or request label Nov 27, 2023
@luojiyin1987
Copy link
Contributor

luojiyin1987 commented Dec 22, 2023

mobx-restful-tablemobx-restful 是否有依赖关系? mobx-strapi 是否可以直接替换 ?

image

@TechQuery
Copy link
Member Author

TechQuery commented Dec 22, 2023

mobx-restful-tablemobx-restful 是否有依赖关系? mobx-strapi 是否可以直接替换 ?

  1. peerDependencies 关系
  2. 可,但需要修改接口路径、数据类型

@TechQuery
Copy link
Member Author

TechQuery commented Dec 23, 2023

我在 #207 已把 Strapi API 的 HTTP 客户端接好,可直接引用:

export const strapiClient = new HTTPClient({
baseURI: `${
process.env.NODE_ENV === 'development'
? 'http://127.0.0.1:1337'
: 'https://hackathon-server.kaiyuanshe.cn'
}/api/`,
responseType: 'json',
}).use(({ request }, next) => {
if (token)
request.headers = { ...request.headers, Authorization: `Bearer ${token}` };
return next();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment