-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Open
Description
🧐 问题描述 | Problem description
💻 示例代码 | Sample code
在User\Login\index.tsx,用户登录成功后,保存数据到currentUser
//保存用户等信息
if (msg) {
flushSync(() => {
setInitialState((s) => ({
...s,
currentUser: msg.data,
}));
});
}
currentUser 的定义
declare namespace API {
type CurrentUser = {
user_id?: number;
owner_id?:number;
username?:string;
fullname?: string;
**access_token?:string;**
is_admin?:number;
role_id?:number;
avatar?: string;
email?: string;
signature?: string;
title?: string;
group?: string;
tags?: { key?: string; label?: string }[];
notifyCount?: number;
unreadCount?: number;
country?: string;
access?: string;
geographic?: {
province?: { label?: string; key?: string };
city?: { label?: string; key?: string };
};
address?: string;
phone?: string;
};
在requestErrorConfig.ts中的requestInterceptors里面如何取出这个currentUser 里面的access_token并加到headers中去? 考虑到安全性,不使用localStorage
🚑 其他信息 | Other information
OS:
Node:
浏览器 | browser:
Metadata
Metadata
Assignees
Labels
No labels