feat: login page, 401 interceptor, nav sign-out

This commit is contained in:
2026-05-09 12:36:40 -07:00
parent 0d70fb118d
commit fe64f0ead4
3 changed files with 78 additions and 0 deletions
+10
View File
@@ -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 }),