frontend fully integreated with the backend
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import axios, { type AxiosError } from 'axios'
|
||||
|
||||
export const api = axios.create({
|
||||
baseURL: process.env.NEXT_PUBLIC_API_URL ?? 'http://localhost:5000',
|
||||
baseURL: process.env.NEXT_PUBLIC_API_URL ?? 'http://localhost:5089/api',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
|
||||
@@ -21,8 +21,8 @@ api.interceptors.response.use(
|
||||
(error: AxiosError<{ error: string }>) => {
|
||||
const status = error.response?.status
|
||||
if (status === 401) {
|
||||
// Redirect to login when auth is implemented
|
||||
if (typeof window !== 'undefined') window.location.href = '/login'
|
||||
return new Promise(() => {}) // redirect in progress — never resolve so no error toast fires
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user