Browse Source

fix: disable localstorage sync in embedded

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/765/head
Pranav C 3 years ago
parent
commit
23b7f1d290
  1. 10
      packages/nc-gui/components/base/shareBase.vue
  2. 45
      packages/nc-gui/plugins/localStorage.js

10
packages/nc-gui/components/base/shareBase.vue

@ -127,11 +127,11 @@ export default {
generateEmbeddableIframe() {
copyTextToClipboard(`<iframe
class="nc-embed"
src="${this.url}?embedded"
frameborder="0"
width="100%"
height="700"
style="background: transparent; "></iframe>`)
src="${this.url}?embed"
frameborder="0"
width="100%"
height="700"
style="background: transparent; "></iframe>`)
this.$toast.success('Copied embeddable html code!').goAway(3000)
}
}

45
packages/nc-gui/plugins/localStorage.js

@ -5,7 +5,7 @@ import isDev from '../helpers/xutils'
const ls = new SecureLS({ isCompression: false })
export default async({ store, $vuetify: { theme } }) => {
export default async({ store, $vuetify: { theme }, route }) => {
/**
*
*/
@ -36,27 +36,30 @@ export default async({ store, $vuetify: { theme } }) => {
// if (process.client) {
//
// window.onNuxtReady(async (nuxt) => {
createPersistedState({
fetchBeforeUse: true,
async rehydrated(store) {
window.rehydrated = true
console.log(store.state.windows)
console.log('Date difference ', await store.dispatch('windows/ActGetExpiryDate'))
},
paths: ['users', 'sqlClient', 'apiClient', 'panelSize', 'windows', 'graphqlClient', 'apiClientSwagger', 'app'],
...(
isDev()
? {}
: {
storage: {
getItem: key => ls.get(key),
setItem: (key, value) => ls.set(key, value),
removeItem: key => ls.remove(key)
if (route && route.query && 'embed' in route.query) {
window.rehydrated = true
} else {
createPersistedState({
fetchBeforeUse: true,
async rehydrated(store) {
window.rehydrated = true
console.log(store.state.windows)
console.log('Date difference ', await store.dispatch('windows/ActGetExpiryDate'))
},
paths: ['users', 'sqlClient', 'apiClient', 'panelSize', 'windows', 'graphqlClient', 'apiClientSwagger', 'app'],
...(
isDev()
? {}
: {
storage: {
getItem: key => ls.get(key),
setItem: (key, value) => ls.set(key, value),
removeItem: key => ls.remove(key)
}
}
}
)
})(store) // vuex plugins can be connected to store, even after creation
)
})(store) // vuex plugins can be connected to store, even after creation
}
}
/**

Loading…
Cancel
Save