Browse Source

code cleaning

Skylsmoi 5 years ago
parent
commit
dc5aafa8e0
2 changed files with 15 additions and 17 deletions
  1. 14 14
      src/action.async.js
  2. 1 3
      src/container/PopupCreateHtmlDocument.jsx

+ 14 - 14
src/action.async.js View File

@@ -3,8 +3,8 @@ import { FETCH_CONFIG } from './helper.js'
3 3
 export const getHtmlDocContent = (user, apiUrl, idWorkspace, idContent) =>
4 4
   fetch(`${apiUrl}/workspaces/${idWorkspace}/html-documents/${idContent}`, {
5 5
     headers: {
6
-      ...FETCH_CONFIG.headers,
7
-      'Authorization': 'Basic ' + user.auth
6
+      'Authorization': 'Basic ' + user.auth,
7
+      ...FETCH_CONFIG.headers
8 8
     },
9 9
     method: 'GET'
10 10
   })
@@ -12,8 +12,8 @@ export const getHtmlDocContent = (user, apiUrl, idWorkspace, idContent) =>
12 12
 export const getHtmlDocComment = (user, apiUrl, idWorkspace, idContent) =>
13 13
   fetch(`${apiUrl}/workspaces/${idWorkspace}/contents/${idContent}/comments`, {
14 14
     headers: {
15
-      ...FETCH_CONFIG.headers,
16
-      'Authorization': 'Basic ' + user.auth
15
+      'Authorization': 'Basic ' + user.auth,
16
+      ...FETCH_CONFIG.headers
17 17
     },
18 18
     method: 'GET'
19 19
   })
@@ -21,8 +21,8 @@ export const getHtmlDocComment = (user, apiUrl, idWorkspace, idContent) =>
21 21
 export const getHtmlDocRevision = (user, apiUrl, idWorkspace, idContent) =>
22 22
   fetch(`${apiUrl}/workspaces/${idWorkspace}/html-documents/${idContent}/revisions`, {
23 23
     headers: {
24
-      ...FETCH_CONFIG.headers,
25
-      'Authorization': 'Basic ' + user.auth
24
+      'Authorization': 'Basic ' + user.auth,
25
+      ...FETCH_CONFIG.headers
26 26
     },
27 27
     method: 'GET'
28 28
   })
@@ -30,8 +30,8 @@ export const getHtmlDocRevision = (user, apiUrl, idWorkspace, idContent) =>
30 30
 export const postHtmlDocNewComment = (user, apiUrl, idWorkspace, idContent, newComment) =>
31 31
   fetch(`${apiUrl}/workspaces/${idWorkspace}/contents/${idContent}/comments`, {
32 32
     headers: {
33
-      ...FETCH_CONFIG.headers,
34
-      'Authorization': 'Basic ' + user.auth
33
+      'Authorization': 'Basic ' + user.auth,
34
+      ...FETCH_CONFIG.headers
35 35
     },
36 36
     method: 'POST',
37 37
     body: JSON.stringify({
@@ -42,8 +42,8 @@ export const postHtmlDocNewComment = (user, apiUrl, idWorkspace, idContent, newC
42 42
 export const putHtmlDocContent = (user, apiUrl, idWorkspace, idContent, label, newContent) =>
43 43
   fetch(`${apiUrl}/workspaces/${idWorkspace}/html-documents/${idContent}`, {
44 44
     headers: {
45
-      ...FETCH_CONFIG.headers,
46
-      'Authorization': 'Basic ' + user.auth
45
+      'Authorization': 'Basic ' + user.auth,
46
+      ...FETCH_CONFIG.headers
47 47
     },
48 48
     method: 'PUT',
49 49
     body: JSON.stringify({
@@ -55,8 +55,8 @@ export const putHtmlDocContent = (user, apiUrl, idWorkspace, idContent, label, n
55 55
 export const putHtmlDocStatus = (user, apiUrl, idWorkspace, idContent, newStatus) =>
56 56
   fetch(`${apiUrl}/workspaces/${idWorkspace}/html-documents/${idContent}/status`, {
57 57
     headers: {
58
-      ...FETCH_CONFIG.headers,
59
-      'Authorization': 'Basic ' + user.auth
58
+      'Authorization': 'Basic ' + user.auth,
59
+      ...FETCH_CONFIG.headers
60 60
     },
61 61
     method: 'PUT',
62 62
     body: JSON.stringify({
@@ -67,8 +67,8 @@ export const putHtmlDocStatus = (user, apiUrl, idWorkspace, idContent, newStatus
67 67
 export const postHtmlDocContent = (user, apiUrl, idWorkspace, idFolder, contentType, newContentName) =>
68 68
   fetch(`${apiUrl}/workspaces/${idWorkspace}/contents`, {
69 69
     headers: {
70
-      ...FETCH_CONFIG.headers,
71
-      'Authorization': 'Basic ' + user.auth
70
+      'Authorization': 'Basic ' + user.auth,
71
+      ...FETCH_CONFIG.headers
72 72
     },
73 73
     method: 'POST',
74 74
     body: JSON.stringify({

+ 1 - 3
src/container/PopupCreateHtmlDocument.jsx View File

@@ -64,9 +64,7 @@ class PopupCreateHtmlDocument extends React.Component {
64 64
         if (resSave.apiResponse.status === 200) {
65 65
           this.handleClose()
66 66
 
67
-          GLOBAL_dispatchEvent({
68
-            type: 'refreshContentList'
69
-          })
67
+          GLOBAL_dispatchEvent({ type: 'refreshContentList', data: {} })
70 68
 
71 69
           GLOBAL_dispatchEvent({
72 70
             type: 'openContentUrl', // handled by tracim_front:src/container/WorkspaceContent.jsx