|
@@ -1,38 +1,53 @@
|
1
|
1
|
import { FETCH_CONFIG } from './helper.js'
|
2
|
2
|
|
3
|
|
-export const getThreadContent = (apiUrl, idWorkspace, idContent) =>
|
|
3
|
+export const getThreadContent = (user, apiUrl, idWorkspace, idContent) =>
|
4
|
4
|
fetch(`${apiUrl}/workspaces/${idWorkspace}/threads/${idContent}`, {
|
5
|
|
- ...FETCH_CONFIG,
|
|
5
|
+ headers: {
|
|
6
|
+ ...FETCH_CONFIG.headers,
|
|
7
|
+ 'Authorization': 'Basic ' + user.auth
|
|
8
|
+ },
|
6
|
9
|
method: 'GET'
|
7
|
10
|
})
|
8
|
11
|
|
9
|
|
-export const getThreadComment = (apiUrl, idWorkspace, idContent) =>
|
|
12
|
+export const getThreadComment = (user, apiUrl, idWorkspace, idContent) =>
|
10
|
13
|
fetch(`${apiUrl}/workspaces/${idWorkspace}/contents/${idContent}/comments`, {
|
11
|
|
- ...FETCH_CONFIG,
|
|
14
|
+ headers: {
|
|
15
|
+ ...FETCH_CONFIG.headers,
|
|
16
|
+ 'Authorization': 'Basic ' + user.auth
|
|
17
|
+ },
|
12
|
18
|
method: 'GET'
|
13
|
19
|
})
|
14
|
20
|
|
15
|
|
-export const postThreadNewComment = (apiUrl, idWorkspace, idContent, newComment) =>
|
|
21
|
+export const postThreadNewComment = (user, apiUrl, idWorkspace, idContent, newComment) =>
|
16
|
22
|
fetch(`${apiUrl}/workspaces/${idWorkspace}/contents/${idContent}/comments`, {
|
17
|
|
- ...FETCH_CONFIG,
|
|
23
|
+ headers: {
|
|
24
|
+ ...FETCH_CONFIG.headers,
|
|
25
|
+ 'Authorization': 'Basic ' + user.auth
|
|
26
|
+ },
|
18
|
27
|
method: 'POST',
|
19
|
28
|
body: JSON.stringify({
|
20
|
29
|
raw_content: newComment
|
21
|
30
|
})
|
22
|
31
|
})
|
23
|
32
|
|
24
|
|
-export const putThreadStatus = (apiUrl, idWorkspace, idContent, newStatus) =>
|
|
33
|
+export const putThreadStatus = (user, apiUrl, idWorkspace, idContent, newStatus) =>
|
25
|
34
|
fetch(`${apiUrl}/workspaces/${idWorkspace}/threads/${idContent}/status`, {
|
26
|
|
- ...FETCH_CONFIG,
|
|
35
|
+ headers: {
|
|
36
|
+ ...FETCH_CONFIG.headers,
|
|
37
|
+ 'Authorization': 'Basic ' + user.auth
|
|
38
|
+ },
|
27
|
39
|
method: 'PUT',
|
28
|
40
|
body: JSON.stringify({
|
29
|
41
|
status: newStatus
|
30
|
42
|
})
|
31
|
43
|
})
|
32
|
44
|
|
33
|
|
-export const postThreadContent = (apiUrl, idWorkspace, idFolder, contentType, newContentName) =>
|
|
45
|
+export const postThreadContent = (user, apiUrl, idWorkspace, idFolder, contentType, newContentName) =>
|
34
|
46
|
fetch(`${apiUrl}/workspaces/${idWorkspace}/contents`, {
|
35
|
|
- ...FETCH_CONFIG,
|
|
47
|
+ headers: {
|
|
48
|
+ ...FETCH_CONFIG.headers,
|
|
49
|
+ 'Authorization': 'Basic ' + user.auth
|
|
50
|
+ },
|
36
|
51
|
method: 'POST',
|
37
|
52
|
body: JSON.stringify({
|
38
|
53
|
parent_id: idFolder,
|
|
@@ -41,9 +56,12 @@ export const postThreadContent = (apiUrl, idWorkspace, idFolder, contentType, ne
|
41
|
56
|
})
|
42
|
57
|
})
|
43
|
58
|
|
44
|
|
-export const putThreadContent = (apiUrl, idWorkspace, idContent, label) =>
|
|
59
|
+export const putThreadContent = (user, apiUrl, idWorkspace, idContent, label) =>
|
45
|
60
|
fetch(`${apiUrl}/workspaces/${idWorkspace}/threads/${idContent}`, {
|
46
|
|
- ...FETCH_CONFIG,
|
|
61
|
+ headers: {
|
|
62
|
+ ...FETCH_CONFIG.headers,
|
|
63
|
+ 'Authorization': 'Basic ' + user.auth
|
|
64
|
+ },
|
47
|
65
|
method: 'PUT',
|
48
|
66
|
body: JSON.stringify({
|
49
|
67
|
label: label,
|