mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-17 18:21:04 +10:00
implement new invitation system
* fix comments on the frontend * move jwt token service to its own module * other fixes and updates
This commit is contained in:
@ -10,7 +10,14 @@ const api: AxiosInstance = axios.create({
|
||||
api.interceptors.request.use(
|
||||
(config) => {
|
||||
const tokenData = Cookies.get("authTokens");
|
||||
const accessToken = tokenData && JSON.parse(tokenData)?.accessToken;
|
||||
|
||||
let accessToken: string;
|
||||
try {
|
||||
accessToken = tokenData && JSON.parse(tokenData)?.accessToken;
|
||||
} catch (err) {
|
||||
console.log("invalid authTokens:", err.message);
|
||||
Cookies.remove("authTokens");
|
||||
}
|
||||
|
||||
if (accessToken) {
|
||||
config.headers.Authorization = `Bearer ${accessToken}`;
|
||||
|
||||
Reference in New Issue
Block a user