Skip to content

Commit

Permalink
fix: Document has to be wrap into a data object to update instance
Browse files Browse the repository at this point in the history
  • Loading branch information
cballevre authored and Crash-- committed Aug 16, 2023
1 parent 59a7df2 commit b83bf51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 3 additions & 5 deletions packages/cozy-stack-client/src/SettingsCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ class SettingsCollection extends DocumentCollection {
let resp

if (document._id === 'io.cozy.settings.instance') {
resp = await this.stackClient.fetchJSON(
'PUT',
'/settings/instance',
document
)
resp = await this.stackClient.fetchJSON('PUT', '/settings/instance', {
data: document
})
} else {
resp = await this.stackClient.fetchJSON(
'PUT',
Expand Down
6 changes: 5 additions & 1 deletion packages/cozy-stack-client/src/SettingsCollection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ describe('SettingsCollection', () => {
expect(stackClient.fetchJSON).toHaveBeenCalledWith(
'PUT',
'/settings/instance',
{ _id: 'io.cozy.settings.instance' }
{
data: {
_id: 'io.cozy.settings.instance'
}
}
)

await collection.update({ _id: 'instance' })
Expand Down

0 comments on commit b83bf51

Please sign in to comment.