diff --git a/assets/js/utils.js b/assets/js/utils.js index ef5671a..cee358d 100644 --- a/assets/js/utils.js +++ b/assets/js/utils.js @@ -74,26 +74,6 @@ export function isObject(o) { return !!o && o.constructor === Object && Object.keys(o).length !== 0 && typeof o !== 'undefined'; } -// is email? -export function validateEmail(email) { - const re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; - return re.test(email); -} - -// AUTH -// Set JWT token in localStorage -export function setJWTstorage(key, value) { - localStorage.setItem(key, value); -} -// Get JWT token from localStorage -export function getJWTstorage(key) { - return localStorage.getItem(key); -} -// Delete JTW token from localStorage -export function deleteJWTstorage(key) { - localStorage.removeItem(key); -} - // copy to clipboard export function copyToClipboard(str) { const el = document.createElement('textarea'); diff --git a/plugins/persistedState.client.js b/plugins/persistedState.client.js index 793f9c0..57468cd 100644 --- a/plugins/persistedState.client.js +++ b/plugins/persistedState.client.js @@ -1,8 +1,10 @@ import createPersistedState from 'vuex-persistedstate'; export default ({ store }) => { - createPersistedState({ - key: 'vuex', - paths: ['loadState', 'snippetsArray', 'snippetsAmount', 'contentType', 'bookType', 'token'], - })(store); + window.onNuxtReady(() => { + createPersistedState({ + key: 'vuex', + paths: ['loadState', 'snippetsAmount', 'contentType', 'bookType'], + })(store); + }) };