|
@@ -16,11 +16,15 @@ import {
|
16
|
16
|
} from 'tracim_frontend_lib'
|
17
|
17
|
import {
|
18
|
18
|
getWorkspaceContentList,
|
19
|
|
- getFolderContent
|
|
19
|
+ getFolderContent,
|
|
20
|
+ putWorkspaceContentArchived,
|
|
21
|
+ putWorkspaceContentDeleted
|
20
|
22
|
} from '../action-creator.async.js'
|
21
|
23
|
import {
|
22
|
24
|
newFlashMessage,
|
23
|
|
- setWorkspaceContentList
|
|
25
|
+ setWorkspaceContentList,
|
|
26
|
+ setWorkspaceContentArchived,
|
|
27
|
+ setWorkspaceContentDeleted
|
24
|
28
|
} from '../action-creator.sync.js'
|
25
|
29
|
|
26
|
30
|
const qs = require('query-string')
|
|
@@ -125,14 +129,34 @@ class WorkspaceContent extends React.Component {
|
125
|
129
|
console.log('%c<WorkspaceContent> download nyi', 'color: #c17838', content)
|
126
|
130
|
}
|
127
|
131
|
|
128
|
|
- handleClickArchiveContentItem = (e, content) => {
|
|
132
|
+ handleClickArchiveContentItem = async (e, content) => {
|
|
133
|
+ const { props, state } = this
|
|
134
|
+
|
129
|
135
|
e.stopPropagation()
|
130
|
|
- console.log('%c<WorkspaceContent> archive nyi', 'color: #c17838', content)
|
|
136
|
+
|
|
137
|
+ const fetchPutContentArchived = await props.dispatch(putWorkspaceContentArchived(props.user, content.idWorkspace, content.id))
|
|
138
|
+ switch (fetchPutContentArchived.status) {
|
|
139
|
+ case 204:
|
|
140
|
+ props.dispatch(setWorkspaceContentArchived(content.idWorkspace, content.id))
|
|
141
|
+ this.loadContentList(state.workspaceIdInUrl)
|
|
142
|
+ break
|
|
143
|
+ default: props.dispatch(newFlashMessage(props.t('Error while archiving document')))
|
|
144
|
+ }
|
131
|
145
|
}
|
132
|
146
|
|
133
|
|
- handleClickDeleteContentItem = (e, content) => {
|
|
147
|
+ handleClickDeleteContentItem = async (e, content) => {
|
|
148
|
+ const { props, state } = this
|
|
149
|
+
|
134
|
150
|
e.stopPropagation()
|
135
|
|
- console.log('%c<WorkspaceContent> delete nyi', 'color: #c17838', content)
|
|
151
|
+
|
|
152
|
+ const fetchPutContentDeleted = await props.dispatch(putWorkspaceContentDeleted(props.user, content.idWorkspace, content.id))
|
|
153
|
+ switch (fetchPutContentDeleted.status) {
|
|
154
|
+ case 204:
|
|
155
|
+ props.dispatch(setWorkspaceContentDeleted(content.idWorkspace, content.id))
|
|
156
|
+ this.loadContentList(state.workspaceIdInUrl)
|
|
157
|
+ break
|
|
158
|
+ default: props.dispatch(newFlashMessage(props.t('Error while deleting document')))
|
|
159
|
+ }
|
136
|
160
|
}
|
137
|
161
|
|
138
|
162
|
handleClickFolder = folderId => {
|