Skip to content

Commit

Permalink
Use BASE_URL instead of middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
brachkow committed May 9, 2024
1 parent 8152f6b commit 2eef5a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions functions/_middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { PagesFunction } from '@cloudflare/workers-types';

export const onRequest: PagesFunction = async ({ next }) => {
const response = await next();
response.headers.set('Access-Control-Allow-Origin', '*');
response.headers.set('Access-Control-Max-Age', '86400');
return response;
};
5 changes: 4 additions & 1 deletion src/axios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export const createCustomAxiosInstance = (
userConfig,
) as CustomAxiosInstanceConfig;

const instance = axios.create();
const instance = axios.create({
baseURL:
import.meta.env.VITE_API_BASE_URL ?? 'https://app.tough-dev.school',
});

const { useResponseCaseMiddleware, useRequestCaseMiddleware } = config;

Expand Down

0 comments on commit 2eef5a0

Please sign in to comment.