Skip to content

Commit

Permalink
11 add apis folder (#12)
Browse files Browse the repository at this point in the history
* feat: implemented login and register page as per the design

* fic URLs not working on page refresh or when written manually bug

* fix: fixed homepage responsiveness

* feat: added apis folder
  • Loading branch information
yll0rd authored Sep 21, 2024
1 parent fd86fa1 commit ef56710
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PUBLIC_API_URL = 'example.com/api/v1'
VITE_PUBLIC_API_URL = 'example.com/api/v1'
20 changes: 20 additions & 0 deletions src/apis/axios.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import axios, { AxiosError, InternalAxiosRequestConfig } from "axios";

const baseURL = `${import.meta.env.VITE_PUBLIC_API_URL}/api/v1/`;

// Create an axios instance with the base URL
const axiosClient = axios.create({
baseURL,
});

axiosClient.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
// config.headers["access-control-allow-origin"] = "*";
return config;
},
(error: AxiosError) => {
return Promise.reject(error);
}
);

export default axiosClient;
1 change: 1 addition & 0 deletions src/apis/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This function contains the different API functions

0 comments on commit ef56710

Please sign in to comment.