mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
fix: authorization token refresh
This commit is contained in:
@@ -94,6 +94,10 @@ export async function setAuthorization(config: AxiosRequestConfig<unknown>) {
|
||||
}
|
||||
if (isAccessTokenExpired(token.accessToken)) {
|
||||
await refreshToken();
|
||||
token = getToken();
|
||||
}
|
||||
if (!token) {
|
||||
throw new Error('No authorization token.');
|
||||
}
|
||||
if (!config.headers) {
|
||||
config.headers = {};
|
||||
|
||||
@@ -199,7 +199,7 @@ export async function downloadWorkspace(
|
||||
responseType: 'arraybuffer',
|
||||
});
|
||||
|
||||
return data.data;
|
||||
return data?.data;
|
||||
}
|
||||
|
||||
export async function uploadBlob(params: { blob: Blob }): Promise<string> {
|
||||
|
||||
Reference in New Issue
Block a user