From 5a7e37077a41049a40b1b90d310b1212fb773f9f Mon Sep 17 00:00:00 2001 From: strNophix Date: Tue, 4 Oct 2022 17:51:07 +0200 Subject: [PATCH] Moved from React proxy to config --- client/package.json | 5 ++--- client/src/config/index.ts | 1 + client/src/lib/axios.ts | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 client/src/config/index.ts create mode 100644 client/src/lib/axios.ts diff --git a/client/package.json b/client/package.json index ef950a4..4cc71a6 100644 --- a/client/package.json +++ b/client/package.json @@ -49,6 +49,5 @@ "tailwindcss": "^3.1.8", "typescript": "^4.6.4", "vite": "^3.1.0" - }, - "proxy": "http://localhost:5000" -} + } +} \ No newline at end of file diff --git a/client/src/config/index.ts b/client/src/config/index.ts new file mode 100644 index 0000000..0441f6a --- /dev/null +++ b/client/src/config/index.ts @@ -0,0 +1 @@ +export const API_URL = 'http://localhost:5000'; diff --git a/client/src/lib/axios.ts b/client/src/lib/axios.ts new file mode 100644 index 0000000..a4521ca --- /dev/null +++ b/client/src/lib/axios.ts @@ -0,0 +1,7 @@ +import { API_URL } from '@/config'; +import Axios from 'axios'; + +export const axios = Axios.create({ + baseURL: API_URL, + withCredentials: true, +});