-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaxios.ts
More file actions
29 lines (25 loc) · 850 Bytes
/
axios.ts
File metadata and controls
29 lines (25 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import apiRequest from '@shared/apis/setting/axiosInstance';
import { formatLocalDateTime } from '@shared/utils/formatDateTime';
export const getDashboardCategories = async () => {
const { data } = await apiRequest.get('/api/v1/categories/dashboard');
return data.data;
};
export const postCategory = async (categoryName: string) => {
const response = await apiRequest.post('/api/v1/categories', {
categoryName,
});
return response;
};
export const putCategory = async (id: number, categoryName: string) => {
const response = await apiRequest.put(`/api/v1/categories/${id}`, {
categoryName,
});
return response;
};
export const getAcorns = async () => {
const now = formatLocalDateTime(new Date());
const { data } = await apiRequest.get('/api/v1/users/acorns?now=', {
params: { now },
});
return data.data;
};