We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f41b954 commit 8ef62c2Copy full SHA for 8ef62c2
1 file changed
src/lib/interceptors/DefaultRequestInterceptor.ts
@@ -3,14 +3,16 @@ import { API_ENDPOINT } from 'src/config'
3
import { isProduction } from 'src/utils/Environment'
4
import { firebaseAuth } from '../firebase'
5
6
+const protectedEndpoints = ['/user']
7
+
8
export async function DefaultRequestInterceptor(config: InternalAxiosRequestConfig) {
9
if (config) {
10
config.baseURL = isProduction() ? API_ENDPOINT : '/api'
11
if (config.headers) {
12
config.headers.Accept = 'application/json'
13
}
14
- if (config.url?.startsWith('/engine/')) {
15
+ if (protectedEndpoints.some((endpoint) => config.url?.includes(endpoint))) {
16
const token = await getUserToken()
17
if (token) {
18
config.headers.Authorization = `Bearer ${token}`
0 commit comments