1
0

Merge branch 'main' into vue3

This commit is contained in:
Dominik Pschenitschni
2021-10-15 20:43:11 +02:00
16 changed files with 126 additions and 80 deletions

View File

@ -163,6 +163,9 @@ export default {
// object passed to this function here still has a reference to the store.
this.labelEditLabel = new LabelModel({
...label,
// The model does not support passing dates into it directly so we need to convert them first
created: +label.created,
updated: +label.updated,
})
this.isLabelEdit = true

View File

@ -104,13 +104,13 @@
<script>
import {mapState} from 'vuex'
import router from '../../router'
import {HTTPFactory} from '@/http-common'
import {ERROR_MESSAGE, LOADING} from '@/store/mutation-types'
import legal from '../../components/misc/legal'
import ApiConfig from '@/components/misc/api-config.vue'
import {getErrorText} from '@/message'
import {redirectToProvider} from '../../helpers/redirectToProvider'
import {getLastVisited, clearLastVisited} from '../../helpers/saveLastVisited'
export default {
components: {
@ -142,9 +142,18 @@ export default {
})
}
// Check if the user is already logged in, if so, redirect him to the homepage
// Check if the user is already logged in, if so, redirect them to the homepage
if (this.authenticated) {
router.push({name: 'home'})
const last = getLastVisited()
if (last !== null) {
this.$router.push({
name: last.name,
params: last.params,
})
clearLastVisited()
} else {
this.$router.push({name: 'home'})
}
}
},
created() {

View File

@ -14,6 +14,7 @@ import {mapState} from 'vuex'
import {ERROR_MESSAGE, LOADING} from '@/store/mutation-types'
import {getErrorText} from '@/message'
import {clearLastVisited, getLastVisited} from '../../helpers/saveLastVisited'
export default {
name: 'Auth',
@ -63,7 +64,16 @@ export default {
code: this.$route.query.code,
})
.then(() => {
this.$router.push({name: 'home'})
const last = getLastVisited()
if (last !== null) {
this.$router.push({
name: last.name,
params: last.params,
})
clearLastVisited()
} else {
this.$router.push({name: 'home'})
}
})
.catch(e => {
const err = getErrorText(e)

View File

@ -116,7 +116,7 @@ export default {
}
},
beforeMount() {
// Check if the user is already logged in, if so, redirect him to the homepage
// Check if the user is already logged in, if so, redirect them to the homepage
if (this.authenticated) {
router.push({name: 'home'})
}