Skip to content

Commit

Permalink
feat: Query io.cozy.settings.bitwarden in SettingsCollection
Browse files Browse the repository at this point in the history
This is a dirty quick fix waiting for this issue to be resolved
cozy/cozy-stack#3864
  • Loading branch information
zatteo committed Apr 3, 2023
1 parent 2d76220 commit 3447594
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/cozy-stack-client/src/SettingsCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ class SettingsCollection extends DocumentCollection {
* @returns {object} The response from the route
*/
async get(id) {
// This is a dirty quick fix waiting for this issue to be resolved
// https://github.com/cozy/cozy-stack/issues/3864
if (id === 'io.cozy.settings.bitwarden') {
const resp = await this.stackClient.fetchJSON(
'GET',
'/data/io.cozy.settings/io.cozy.settings.bitwarden'
)
return {
data: DocumentCollection.normalizeDoctypeJsonApi(SETTINGS_DOCTYPE)(
{
id: '/data/io.cozy.settings/io.cozy.settings.bitwarden',
...resp
},
resp
)
}
}

let path

if (id.startsWith('io.cozy.settings.')) {
Expand Down
6 changes: 6 additions & 0 deletions packages/cozy-stack-client/src/SettingsCollection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ describe('SettingsCollection', () => {
'GET',
'/settings/disk-usage'
)

await collection.get('io.cozy.settings.bitwarden')
expect(stackClient.fetchJSON).toHaveBeenCalledWith(
'GET',
'/data/io.cozy.settings/io.cozy.settings.bitwarden'
)
})

it('should format correctly the response', async () => {
Expand Down

0 comments on commit 3447594

Please sign in to comment.