Update: P12.1 URL manipulation
| | |
| | | '/api/access_analysis/insert' |
| | | ]; |
| | | |
| | | const BASE_URL = process.env.BASE_URL; |
| | | const BASE_URL = process.env.BASE_URL!; |
| | | |
| | | function sanitizeBaseUrl(baseUrl: string): string { |
| | | const isValidBaseUrl = (url: string) => url.includes('api'); |
| | | if (isValidBaseUrl(baseUrl)) { |
| | | return baseUrl; |
| | | } else { |
| | | throw new Error('Invalid BASE_URL'); |
| | | } |
| | | } |
| | | |
| | | export const http = axios.create({ |
| | | baseURL: BASE_URL, |
| | | withCredentials: true, |
| | | baseURL: sanitizeBaseUrl(BASE_URL), |
| | | withCredentials: true |
| | | }); |
| | | |
| | | let apiNumber = 0; |