Преглед изворни кода

refactor(axios): 导出所有接口类型以增强代码复用性

这些接口类型被多个模块使用,导出它们可以避免重复定义并提高代码的可维护性
Sakulin пре 2 месеци
родитељ
комит
54a5115905
1 измењених фајлова са 12 додато и 12 уклоњено
  1. 12 12
      src/utils/axios.ts

+ 12 - 12
src/utils/axios.ts

@@ -9,22 +9,22 @@ const baseServer = axios.create({
   },
 })
 
-interface AuthSuccess {
+export interface AuthSuccess {
   code: 200
   token: string
 }
 
-interface AuthFailed {
+export interface AuthFailed {
   code: 401
   msg: string
 }
 
-interface PostListSuccess {
+export interface PostListSuccess {
   code: number
   data: Datum[]
 }
 
-interface Datum {
+export interface Datum {
   id: number
   title: string
   createdAt: string
@@ -32,23 +32,23 @@ interface Datum {
   tags: Tag[]
 }
 
-interface Tag {
+export interface Tag {
   name: string
   id: number
   color: string
 }
 
-interface TagList {
+export interface TagList {
   code: number
   data: Tag[]
 }
 
-interface PostGetSuccess {
+export interface PostGetSuccess {
   code: number
   data: PostDetail
 }
 
-interface PostDetail {
+export interface PostDetail {
   id: number
   title: string
   content: string
@@ -57,18 +57,18 @@ interface PostDetail {
   tags: Tag[]
 }
 
-interface DefaultFailedResponse {
+export interface DefaultFailedResponse {
   code: 404
   msg: string
 }
 
-interface PostBody {
+export interface PostBody {
   title: string
   content: string
   tags: string[]
 }
 
-interface PushSuccess {
+export interface PushSuccess {
   code: number
   msg: string
   data: {
@@ -76,7 +76,7 @@ interface PushSuccess {
   }
 }
 
-interface UpdateSuccess {
+export interface UpdateSuccess {
   code: 200,
   msg: string
 }