-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmember.ts
51 lines (42 loc) · 1.04 KB
/
member.ts
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
import callAPI from "../config/api";
const ROOT_API = process.env.NEXT_PUBLIC_API;
const API_VERSION = "api/v1";
export async function getMemberOverview() {
const url = `${ROOT_API}/${API_VERSION}/players/dashboard`;
return callAPI({
url,
method: "GET",
token: true,
});
}
export async function getMemberTransactions(valueParams: string) {
let params = "";
if (valueParams === "all") {
params = "";
} else {
params = `?status=${valueParams}`;
}
const url = `${ROOT_API}/${API_VERSION}/players/history${params}`;
return callAPI({
url,
method: "GET",
token: true,
});
}
export async function getTransactionDetail(id: string, token: string) {
const url = `${ROOT_API}/${API_VERSION}/players/history/${id}/detail`;
return callAPI({
url,
method: "GET",
serverToken: token,
});
}
export async function updateProfile(data: FormData, id: string) {
const url = `${ROOT_API}/${API_VERSION}/players/profile/${id}`;
return callAPI({
url,
method: "PUT",
data,
token: true,
});
}