apps/api: use refresh-token from headers

This commit is contained in:
vchikalkin 2024-01-16 12:23:54 +03:00
parent 8470a72d8d
commit f19f7af6a0

View File

@ -20,8 +20,9 @@ export class AppController {
} catch (error) {
const _err = error as Error;
const isTokenExpired = _err.name?.toLocaleLowerCase().includes('expired');
const refreshToken = req.headers['refresh-token'] === '1';
if (isTokenExpired) return this.handleExpiredToken(req, reply, token);
if (isTokenExpired && refreshToken) return this.handleExpiredToken(req, reply, token);
return this.handleError(req, reply);
}