Fix problem with missing loginData
This commit is contained in:
parent
31ae5c7e65
commit
6d8e657fc5
1
TODO.txt
1
TODO.txt
|
@ -14,3 +14,4 @@ Some features that need to be implemented
|
|||
- Better responsive interface
|
||||
- Websockets? Show new channels and new items in channels directly, needs
|
||||
micropub server support
|
||||
- Improve handling of entries with missing values (like missing author)
|
||||
|
|
|
@ -31,8 +31,11 @@
|
|||
name: 'App',
|
||||
components: {LoginModal},
|
||||
mounted() {
|
||||
let loginData = JSON.parse(window.localStorage.getItem('login_data'))
|
||||
this.$store.dispatch('isLoggedIn', loginData)
|
||||
let item = window.localStorage.getItem('login_data');
|
||||
if (item) {
|
||||
let loginData = JSON.parse(item)
|
||||
this.$store.dispatch('isLoggedIn', loginData)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
}).then(response => response.json())
|
||||
.then(response => {
|
||||
this.$store.dispatch('tokenResponse', response)
|
||||
this.active = false
|
||||
this.show = false
|
||||
this.$router.push('/')
|
||||
})
|
||||
}
|
||||
|
|
|
@ -8,14 +8,17 @@ Vue.use(Vuex)
|
|||
export default new Vuex.Store({
|
||||
state() {
|
||||
let loginData = JSON.parse(window.localStorage.getItem('login_data'))
|
||||
return {
|
||||
...loginData,
|
||||
let newState = {
|
||||
channels: [],
|
||||
timeline: {items: [], paging: {}},
|
||||
channel: {},
|
||||
debug: false,
|
||||
logged_in: loginData.access_token && loginData.access_token.length > 0
|
||||
};
|
||||
if (loginData) {
|
||||
newState = { ...newState, ...loginData }
|
||||
newState.logged_in = loginData.access_token && loginData.access_token.length > 0
|
||||
}
|
||||
return newState
|
||||
},
|
||||
|
||||
mutations: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user