-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathservices.js
66 lines (58 loc) · 1.92 KB
/
services.js
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
const baseUrl =
process.env.NEXT_PUBLIC_APP_ENV === "production"
? "https://asia-south1-skillrazr-mobile.cloudfunctions.net/api"
: "http://localhost:5001/skillrazr-mobile/asia-south1/api"; // make sure you are running firebase emulator locally
const tasksApiKey = "hello_tasks_@1234!";
console.log("App env", process.env.NEXT_PUBLIC_APP_ENV);
export const getBoard = async () => {
return await fetch(`${baseUrl}/getBoard`, {
headers: {
"Content-Type": "application/json",
"skillrazr-tasks-app": tasksApiKey,
},
method: "POST",
body: JSON.stringify({}),
}).then((resp) => resp.json());
};
export const addBoard = async (payload) => {
return await fetch(`${baseUrl}/addBoard`, {
headers: {
"Content-Type": "application/json",
"skillrazr-tasks-app": tasksApiKey,
},
method: "POST",
body: JSON.stringify({ payload }),
}).then((resp) => resp.json());
};
export const updateBoard = async (payload) => {
return await fetch(`${baseUrl}/updateBoard`, {
headers: {
"Content-Type": "application/json",
"skillrazr-tasks-app": tasksApiKey,
},
method: "POST",
body: JSON.stringify({ payload }),
}).then((resp) => resp.json());
};
export const addColumn = async (payload) => {
return await fetch(`${baseUrl}/addColumn`, {
headers: {
"Content-Type": "application/json",
"skillrazr-tasks-app": tasksApiKey,
},
method: "POST",
body: JSON.stringify({ payload }),
}).then((resp) => resp.json());
};
export const addCard = async (payload) => {
return await fetch(`${baseUrl}/addCard`, {
headers: {
"Content-Type": "application/json",
"skillrazr-tasks-app": tasksApiKey,
},
method: "POST",
body: JSON.stringify({ payload }),
}).then((resp) => resp.json());
};
//Todo - Write API to implement archiving of a card, an archived card should not be seen in the board
export const archiveCard = async (payload) => {};