Fix auth flows and add daemon heartbeat endpoint
This commit is contained in:
@@ -38,7 +38,13 @@ async function request<T>(path: string, options: RequestOptions = {}): Promise<T
|
||||
|
||||
const res = await fetch(url, { ...fetchOptions, headers });
|
||||
|
||||
if (res.status === 401) {
|
||||
const shouldHandle401WithRefresh =
|
||||
res.status === 401 &&
|
||||
path !== '/auth/login' &&
|
||||
path !== '/auth/register' &&
|
||||
path !== '/auth/refresh';
|
||||
|
||||
if (shouldHandle401WithRefresh) {
|
||||
// Try refresh
|
||||
const refreshed = await refreshToken();
|
||||
if (refreshed) {
|
||||
|
||||
Reference in New Issue
Block a user