Greater, lighter, faster... StackEdit 5 is here!
+Greater, lighter, faster... StackEdit 5 is here!
Please click Next to take a quick tour.
This will create a workspace synchronized with a CouchDB database.
+This feature is restricted to sponsor users as it relies on server resources.
', + content: 'This feature is restricted to sponsors as it relies on server resources.
', resolveText: 'Ok, I understand', }), paymentSuccess: ({ dispatch }) => dispatch('open', { diff --git a/src/store/workspace.js b/src/store/workspace.js index a2f56718..9facee00 100644 --- a/src/store/workspace.js +++ b/src/store/workspace.js @@ -31,13 +31,30 @@ export default { }, syncToken: (state, getters, rootState, rootGetters) => { const workspace = getters.currentWorkspace; - if (workspace.providerId === 'googleDriveWorkspace') { - const googleTokens = rootGetters['data/googleTokens']; - return googleTokens[workspace.sub]; + switch (workspace.providerId) { + case 'googleDriveWorkspace': { + const googleTokens = rootGetters['data/googleTokens']; + return googleTokens[workspace.sub]; + } + case 'couchdbWorkspace': { + const couchdbTokens = rootGetters['data/couchdbTokens']; + return couchdbTokens[workspace.id]; + } + default: + return getters.mainWorkspaceToken; + } + }, + loginToken: (state, getters, rootState, rootGetters) => { + const workspace = getters.currentWorkspace; + switch (workspace.providerId) { + case 'googleDriveWorkspace': { + const googleTokens = rootGetters['data/googleTokens']; + return googleTokens[workspace.sub]; + } + default: + return getters.mainWorkspaceToken; } - return getters.mainWorkspaceToken; }, - loginToken: (state, getters) => getters.syncToken, sponsorToken: (state, getters) => getters.mainWorkspaceToken, }, actions: {