-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaxios.ts
More file actions
79 lines (66 loc) · 1.92 KB
/
axios.ts
File metadata and controls
79 lines (66 loc) · 1.92 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import apiRequest from './axiosInstance';
export interface PostArticleRequest {
url: string;
categoryId: number;
memo?: string | null;
remindTime?: string | null;
}
export const postArticle = async (data: PostArticleRequest) => {
const response = await apiRequest.post('/api/v3/articles', data);
return response.data;
};
export interface postSignupRequest {
email: string;
remindDefault: string;
fcmToken: string;
}
export const postSignup = async (data: postSignupRequest) => {
const response = await apiRequest.post('/api/v1/auth/signup', data);
return response.data;
};
export const getCategoriesExtension = async () => {
const response = await apiRequest.get('/api/v1/categories/extension');
return response.data;
};
export interface postCategoriesRequest {
categoryName: string;
isPublic: boolean;
}
export const postCategories = async (data: postCategoriesRequest) => {
const response = await apiRequest.post('/api/v3/categories', data);
return response.data;
};
export const getRemindTime = async () => {
const now = new Date().toISOString().split('.')[0];
const response = await apiRequest.get('/api/v1/users/remind-time', {
params: { now },
});
return response.data;
};
export const getArticleSaved = async (url: string) => {
const response = await apiRequest.get('/api/v1/articles/saved', {
params: { url },
});
return response.data;
};
export interface PutArticleRequest {
categoryId: number;
memo: string;
now: string;
remindTime: string | null;
}
// 이거 오류남 확인 요망
export const putArticle = async (
articleId: number,
data: PutArticleRequest
) => {
const response = await apiRequest.put(`/api/v1/articles/${articleId}`, {
...data,
});
return response;
};
//아티클 상세조회
export const getArticleDetail = async (articleId: number) => {
const response = await apiRequest.get(`/api/v3/articles/${articleId}`);
return response.data.data;
};