Skip to content

Commit

Permalink
enh: share context to user
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
  • Loading branch information
enjeck committed Apr 11, 2024
1 parent 3ff2750 commit ce7c5c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 1 addition & 7 deletions src/modules/modals/EditContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,7 @@ export default {
nodes: dataResources,
}
const share = {
nodeType: 'context',
nodeId: this.contextId,
receiverType: 'user',
displayMode: 2,
}
const res = await this.$store.dispatch('updateContext', { id: this.contextId, data, share, receivers: this.receivers })
const res = await this.$store.dispatch('updateContext', { id: this.contextId, data, receivers: this.receivers })
if (res) {
showSuccess(t('tables', 'Updated context "{contextTitle}".', { contextTitle: this.title }))
this.actionCancel()
Expand Down
8 changes: 7 additions & 1 deletion src/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,20 @@ export default new Vuex.Store({

return true
},
async updateContext({ state, commit, dispatch }, { id, data, share, receivers }) {
async updateContext({ state, commit, dispatch }, { id, data, receivers }) {
let res = null
let share = {
nodeType: 'context',
nodeId: id,
displayMode: 2,
}

try {
res = await axios.put(generateOcsUrl('/apps/tables/api/2/contexts/' + id), data)
for (const receiver of receivers) {
share.receiverType = receiver.isUser ? 'user' : 'group'
share.receiver = receiver.user
console.log('share', share)
await axios.post(generateUrl('/apps/tables/share'), share)
}
} catch (e) {
Expand Down

0 comments on commit ce7c5c7

Please sign in to comment.