All archive components were calling fetch('/api/...') directly. Replaced
all occurrences of /api/ URLs (string literals, template literals,
window.open, src attributes) with /kitchen/api/ across 37 source files.
The central axios instance in api.ts was already correct.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
507 B
TypeScript
21 lines
507 B
TypeScript
import axios from 'axios'
|
|
|
|
// Central axios instance for new/migrated code.
|
|
// Existing archive components still call fetch('/kitchen/api/...') directly —
|
|
// see port log B5 for the migration tracker.
|
|
const api = axios.create({
|
|
baseURL: '/kitchen/api',
|
|
withCredentials: true,
|
|
})
|
|
|
|
api.interceptors.response.use(
|
|
(r) => r,
|
|
(error) => {
|
|
if (error.response?.status === 401) {
|
|
;(window.top ?? window).location.href = '/login'
|
|
}
|
|
return Promise.reject(error)
|
|
},
|
|
)
|
|
|
|
export default api
|