diff --git a/src/service/http.ts b/src/service/http.ts index 6c99f8c..ba96f6a 100644 --- a/src/service/http.ts +++ b/src/service/http.ts @@ -29,8 +29,19 @@ export interface FetchOption { } export interface ResponseData { + /** + * 后台定义的状态码 + */ errorCode: number; + + /** + * 后台定义的 message + */ errorMessage: string; + + /** + * 实际返回数据 + */ data?: any; } diff --git a/src/service/mock/data.ts b/src/service/mock/data.ts index ae03231..e0d8b47 100644 --- a/src/service/mock/data.ts +++ b/src/service/mock/data.ts @@ -11,10 +11,17 @@ const mockData: MockData = { [apiDef.login]: { errorCode: 200, errorMessage: 'success', + data: { + name: 'dpyzo0o', + age: 100, + }, }, [apiDef.test]: () => ({ errorCode: 200, errorMessage: 'success', + data: { + greeting: 'hello taro-toolkit', + }, }), };