Public Access
feat: login page, 401 interceptor, nav sign-out
This commit is contained in:
@@ -10,6 +10,16 @@ const api = axios.create({
|
||||
withCredentials: true,
|
||||
})
|
||||
|
||||
api.interceptors.response.use(
|
||||
response => response,
|
||||
error => {
|
||||
if (error.response?.status === 401 && window.location.pathname !== '/login') {
|
||||
window.location.href = '/login'
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
export const mealPlannerApi = {
|
||||
auth: {
|
||||
login: (password: string) => api.post('/auth/login', { password }),
|
||||
|
||||
Reference in New Issue
Block a user