diff --git a/src/frontend/src/constants/constants.ts b/src/frontend/src/constants/constants.ts index 8831927bb..27584fd32 100644 --- a/src/frontend/src/constants/constants.ts +++ b/src/frontend/src/constants/constants.ts @@ -509,6 +509,7 @@ export const URL_EXCLUDED_FROM_ERROR_RETRIES = [ "/api/v1/validate/prompt", "http://localhost:7860/login" ]; + export const CONTROL_INPUT_STATE = { password: "", cnfPassword: "", diff --git a/src/frontend/src/controllers/API/api.tsx b/src/frontend/src/controllers/API/api.tsx index 4a5f76173..8c71752b2 100644 --- a/src/frontend/src/controllers/API/api.tsx +++ b/src/frontend/src/controllers/API/api.tsx @@ -13,7 +13,7 @@ const api: AxiosInstance = axios.create({ function ApiInterceptor() { const { setErrorData } = useContext(alertContext); - const { accessToken, refreshAccessToken, login, logout } = useContext(AuthContext); + const { accessToken, login, logout } = useContext(AuthContext); const navigate = useNavigate(); useEffect(() => { @@ -75,9 +75,18 @@ function ApiInterceptor() { // Request interceptor to add access token to every request const requestInterceptor = api.interceptors.request.use( (config) => { + if (accessToken) { config.headers["Authorization"] = `Bearer ${accessToken}`; } + + if( + config?.url?.includes("https://raw.githubusercontent.com/logspace-ai/langflow_examples/main/examples") || + config?.url?.includes("https://api.github.com/repos/logspace-ai/langflow_examples/contents/examples")) + { + delete config.headers["Authorization"]; + } + return config; }, (error) => {