Skip to content

Commit

Permalink
feat: Configure CozyClient to also use StackLink (when online)
Browse files Browse the repository at this point in the history
In previous commit we configured cozy-client to use CozyPouchLink for
its queries

This commit also adds StackLink as the first Link so by default it will
do its queries through the remote cozy-stack

CozyClient has been modified to handle offline mode and redirect to the
next link when it is detected

Related PR: cozy/cozy-client#1507
  • Loading branch information
Ldoppea committed Jul 30, 2024
1 parent eb21cf5 commit 8c2715b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pouchdb/getLinks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { platformReactNative } from '/pouchdb/platformReactNative'

import { StackLink } from 'cozy-client'
import { default as PouchLink } from 'cozy-pouch-link'

export const offlineDoctypes = [
Expand Down Expand Up @@ -31,9 +32,13 @@ export const getLinks = () => {
platform: platformReactNative
}

const stackLink = new StackLink({
platform: platformReactNative
})

const pouchLink = new PouchLink({
...pouchLinkOptions
})

return [pouchLink]
return [stackLink, pouchLink]
}

0 comments on commit 8c2715b

Please sign in to comment.