修改了api集中化 搞定了vuex

This commit is contained in:
2020-10-10 10:19:38 +08:00
parent 8bf7b662d5
commit a67333be23
7 changed files with 112 additions and 61 deletions

27
src/types/index.d.ts vendored
View File

@@ -2,6 +2,19 @@
* 只添加了一些必要的参数,并没有写完整,因为剩下的大部分用不到
*/
// 定义axios
import * as axios from 'axios';
declare module 'axios' {
export interface CustomSuccessData<T> {
code: number;
msg?: string;
data?: T;
[keys: string]: any;
}
}
// 图片选择
export interface ImgInfo {
@@ -20,10 +33,14 @@ export interface VideoInfo {
uid: string;
}
// 返回数据
export interface ResData<T = any>{
code?: number;
msg?: string;
data?: T;
// 登录返回数据
export interface LoginData{
api_token: string;
memberid: number;
}
// 用户信息
export interface UserInfo {
name: string;
img: string;
}