feat : add front-end using shad cn
This commit is contained in:
17
frontend/src/services/api.ts
Normal file
17
frontend/src/services/api.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import axios from "axios";
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: "http://localhost:3000/api",
|
||||
});
|
||||
|
||||
api.interceptors.request.use((config) => {
|
||||
const token = localStorage.getItem("token");
|
||||
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
return config;
|
||||
});
|
||||
|
||||
export default api;
|
||||
Reference in New Issue
Block a user