feat: 新增layout内容

This commit is contained in:
Json_Lee
2025-05-02 19:02:48 +08:00
parent 294e818487
commit 604d1077fe
13 changed files with 368 additions and 15 deletions
+11 -2
View File
@@ -1,10 +1,11 @@
import type { HookFetchPlugin } from 'hook-fetch';
import hookFetch from 'hook-fetch';
import { sseTextDecoderPlugin } from 'hook-fetch/plugins';
interface BaseResponse {
code: number;
data: null;
message: string;
msg: string;
}
const instance = hookFetch.create<BaseResponse, unknown, 'data'>({
@@ -15,9 +16,17 @@ const instance = hookFetch.create<BaseResponse, unknown, 'data'>({
plugins: [sseTextDecoderPlugin()],
});
function jwtPlugin() {
function jwtPlugin(): HookFetchPlugin<BaseResponse> {
return {
name: 'jwt',
afterResponse: async (response) => {
console.log(response);
if (response.result?.code === 200) {
return response;
}
// alert(response.result?.msg);
return Promise.reject(response);
},
};
}