Skip to content

Commit 8ef62c2

Browse files
committed
fix: update request interceptor to use protected endpoints for authorization
1 parent f41b954 commit 8ef62c2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/lib/interceptors/DefaultRequestInterceptor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ import { API_ENDPOINT } from 'src/config'
33
import { isProduction } from 'src/utils/Environment'
44
import { firebaseAuth } from '../firebase'
55

6+
const protectedEndpoints = ['/user']
7+
68
export async function DefaultRequestInterceptor(config: InternalAxiosRequestConfig) {
79
if (config) {
810
config.baseURL = isProduction() ? API_ENDPOINT : '/api'
911
if (config.headers) {
1012
config.headers.Accept = 'application/json'
1113
}
1214

13-
if (config.url?.startsWith('/engine/')) {
15+
if (protectedEndpoints.some((endpoint) => config.url?.includes(endpoint))) {
1416
const token = await getUserToken()
1517
if (token) {
1618
config.headers.Authorization = `Bearer ${token}`

0 commit comments

Comments
 (0)