Skip to content

Commit

Permalink
fix(clientDB): disable clientDB if token is set and has falsy value (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Nov 21, 2022
1 parent 8d4a3ca commit 7c424d3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/runtime/composables/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,13 @@ export const shouldUseClientDB = () => {
if (!process.client) { return false }
if (clientDB?.isSPA) { return true }

const query = useRoute().query
// Disable clientDB when `?preview` is set in query, and it has falsy value
if (Object.prototype.hasOwnProperty.call(query, 'preview') && !query.preview) {
return false
}
// Disable clientDB when preview mode is disabled
if (useRoute().query?.preview || useCookie('previewToken').value) {
if (query.preview || useCookie('previewToken').value) {
return true
}

Expand Down

0 comments on commit 7c424d3

Please sign in to comment.