From 3bd24abbadf3542d3f18679c43e51cb0e3f49b48 Mon Sep 17 00:00:00 2001 From: ian Date: Fri, 15 Oct 2021 22:59:33 +0800 Subject: [PATCH] Pause api queue when refreshing auth (#8827) --- app/src/api.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/api.ts b/app/src/api.ts index 1784982822..6b9f2e2603 100644 --- a/app/src/api.ts +++ b/app/src/api.ts @@ -37,7 +37,13 @@ export const onRequest = (config: AxiosRequestConfig): Promise => }; return new Promise((resolve) => { - queue.add(() => resolve(requestConfig)); + if (config.url && config.url === '/auth/refresh') { + queue.pause(); + resolve(requestConfig); + queue.start(); + } else { + queue.add(() => resolve(requestConfig)); + } }); };