Persist and rehydrate your Vuex store via url search params (window.location.search).
npm i --save vuex-url-search-params
# or
yarn add vuex-url-search-params
npm i --no-save [email protected] [email protected] [email protected] # Optionally
yarn test:jest # Runs Jest with coverage collection
yarn test:coverage # Sends coverage to .coveralls.io
yarn test # yarn test:jest && yarn test:coverage
Look at the quite complex example at CodeSandbox:
Note, this plugin is now suitable only for array-like and iterable Vuex state values!
Mutations types for subscribing.
Object which defines how to <mutationType>
payload will be transform to the query string search param and back
Query string search param name
Function for modifying mutation payload value for using it in a query string search param with key above. Accepts <mutationType>
payload as the first argument and Vuex store object as the second
Function for modifying query string search param value for using it in an appropriate mutation. Accepts query string search param value as the first argument and Vuex store object as the second
Function which result will be used as payload value for mutation when an appropriate query string search param become empty. Accepts Vuex store object as argument
Query string for initialization
Vuex store object