frontend fully integreated with the backend

This commit is contained in:
Kalana B. Thilakarathna
2026-08-25 23:47:33 +05:30
parent 1bee5f91c6
commit 83d3272784
151 changed files with 10724 additions and 573 deletions
+2 -2
View File
@@ -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)
}