-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d6c9a6
commit 7a9e652
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import axios, { type AxiosRequestConfig } from 'axios' | ||
|
||
const apiClient = axios.create({ | ||
baseURL: 'http://localhost:8080', | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-type': 'application/json' | ||
} | ||
} satisfies AxiosRequestConfig) | ||
|
||
export default apiClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import apiClient from '../apiClient' | ||
|
||
export const getAllUsers = async (): Promise<unknown> => { | ||
return await apiClient.get('/all') | ||
} | ||
|
||
export const getUser = async (id: string): Promise<unknown> => { | ||
return await apiClient.get(`/${id}`) | ||
} | ||
|
||
export const createUser = async (user: unknown): Promise<unknown> => { | ||
return await apiClient.post('/', JSON.stringify(user)) | ||
} | ||
|
||
export const updateUser = async (id: string, user: unknown): Promise<unknown> => { | ||
return await apiClient.put(`/${id}`, JSON.stringify(user)) | ||
} | ||
|
||
export const deleteUser = async (id: string): Promise<unknown> => { | ||
return await apiClient.delete(`/${id}`) | ||
} |