Update SSO token before attempting to load profile

pull/12/head^2
Manuel Kasper 2022-08-06 17:26:30 +02:00
rodzic 1dc744460a
commit a36761b70c
1 zmienionych plików z 13 dodań i 10 usunięć

Wyświetl plik

@ -28,17 +28,20 @@ export default {
},
mounted () {
if (this.homeQth === null) {
this.$keycloak.loadUserProfile()
.success(profile => {
if (profile.attributes.Lat && profile.attributes.Lat[0] && profile.attributes.Lon && profile.attributes.Lon[0]) {
this.$store.commit('setHomeQth', {
latitude: parseFloat(profile.attributes.Lat[0]),
longitude: parseFloat(profile.attributes.Lon[0])
this.$keycloak.updateToken(60)
.success(() => {
this.$keycloak.loadUserProfile()
.success(profile => {
if (profile.attributes.Lat && profile.attributes.Lat[0] && profile.attributes.Lon && profile.attributes.Lon[0]) {
this.$store.commit('setHomeQth', {
latitude: parseFloat(profile.attributes.Lat[0]),
longitude: parseFloat(profile.attributes.Lon[0])
})
this.calculate()
} else {
this.$store.commit('setHomeQth', undefined)
}
})
this.calculate()
} else {
this.$store.commit('setHomeQth', undefined)
}
})
} else {
this.calculate()