Skip to content

Commit

Permalink
feat(state): introduce "version" variable
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jul 20, 2022
1 parent d35ee30 commit 84c2b9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions plugins/vuex-persist.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export default (context) => {
asyncStorage: true,

reducer: (state) => ({
version: state.version,

statistics: state.statistics,
}),
}).plugin(store)
Expand Down
11 changes: 8 additions & 3 deletions store/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const state = () => ({
version: 0,

statistics: {
timesTheAppHasBeenOpened: 0,
},
Expand Down Expand Up @@ -26,10 +28,13 @@ export const actions = {
async simpleApiFetch({ state, dispatch }, { url, options }) {
const AXIOS_OPTIONS = {
headers: {
'Authorization': this.$auth.strategy.token.get()
}
Authorization: this.$auth.strategy.token.get(),
},
}

return await dispatch('simpleFetch', { url, options: { ...options, ...AXIOS_OPTIONS } })
return await dispatch('simpleFetch', {
url,
options: { ...options, ...AXIOS_OPTIONS },
})
},
}

0 comments on commit 84c2b9c

Please sign in to comment.