Created
July 6, 2020 18:58
-
-
Save DeVoresyah/335224a670ed1e9ddd6d104958803094 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import createPersistedState from 'vuex-persistedstate' | |
import * as Cookies from "js-cookie"; | |
let cookieStorage = { | |
getItem: function(key) { | |
return Cookies.getJSON(key); | |
}, | |
setItem: function(key, value) { | |
return Cookies.set(key, value, {expires: 3, secure: false}); | |
}, | |
removeItem: function(key) { | |
return Cookies.remove(key); | |
} | |
}; | |
export default ({store}) => { | |
createPersistedState({ | |
key: 'resweepy', | |
storage: cookieStorage, | |
getState: cookieStorage.getItem, | |
setState: cookieStorage.setItem, | |
reducer: (state) => ({ session: state.session }) | |
})(store) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment