-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaxios.ts
More file actions
68 lines (54 loc) · 1.66 KB
/
axios.ts
File metadata and controls
68 lines (54 loc) · 1.66 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
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/v1/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;
}
export const postCategories = async (data: postCategoriesRequest) => {
const response = await apiRequest.post("/api/v1/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.data;
};