MT#64432 Refactor updateSharedValue and getList

* fix updateSharedValue to be less flacky: it was using
  the reference of row, mutated, to make the backend request.
  It now use a value stored in a variable.
* amend getList to make sure we pass the default page (1)
  when looking for all rows with api v1.

Change-Id: Ia8c4fcb1547c16a6a3e862f864fbc5aecda3e065
(cherry picked from commit 9db53bc3ce)
(cherry picked from commit 25eea83751)
mr14.0.1
Debora Crescenzo 4 months ago committed by Crescenzo Debora
parent 816519219d
commit 2bccbbf15c

@ -94,6 +94,7 @@ export async function getList (options) {
}, options) }, options)
if (requestConfig.all === true) { if (requestConfig.all === true) {
requestConfig.params.rows = LIST_ALL_ROWS requestConfig.params.rows = LIST_ALL_ROWS
requestConfig.params.page = LIST_DEFAULT_PAGE
} }
if (requestConfig.resource !== undefined) { if (requestConfig.resource !== undefined) {
requestConfig.path = `api/${requestConfig.resource}/` requestConfig.path = `api/${requestConfig.resource}/`

@ -83,8 +83,9 @@ export default {
await updateEntry(data) await updateEntry(data)
}, },
async updateSharedValue (context, row) { async updateSharedValue (context, row) {
context.commit('setSharedValue', { id: row.id, value: !row.shared }) const newValue = !row.shared
await setSharedValue(row.subscriber_id, row.id, row.shared) context.commit('setSharedValue', { id: row.id, value: newValue })
await setSharedValue(row.id, newValue)
} }
} }
} }

Loading…
Cancel
Save