Pretty all the things I missed
My laptop didn't have lefthook running. Oops.
This commit is contained in:
parent
f60bde7fd9
commit
4bbfbdb9e6
30 changed files with 490 additions and 487 deletions
26
ts/client.ts
26
ts/client.ts
|
|
@ -1,24 +1,24 @@
|
|||
// src/api/axios.js or similar
|
||||
import axios from 'axios';
|
||||
import router from '@/router';
|
||||
import axios from "axios";
|
||||
import router from "@/router";
|
||||
|
||||
const apiClient = axios.create({
|
||||
baseURL: '/api',
|
||||
withCredentials: true
|
||||
baseURL: "/api",
|
||||
withCredentials: true,
|
||||
});
|
||||
|
||||
// Response interceptor to catch auth failures
|
||||
apiClient.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error) => {
|
||||
if (error.response && error.response.status === 401) {
|
||||
// Session expired or not authenticated
|
||||
router.push('/login');
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
(response) => response,
|
||||
(error) => {
|
||||
if (error.response && error.response.status === 401) {
|
||||
// Session expired or not authenticated
|
||||
router.push("/login");
|
||||
}
|
||||
return Promise.reject(error);
|
||||
},
|
||||
);
|
||||
apiClient.isAuthenticated = () => {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
export default apiClient;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue