2018-06-08 18:00:20 +02:00
|
|
|
<!-- this is only used in the tests, to log in quickly -->
|
|
|
|
<script>
|
|
|
|
import { store } from '../_store/store'
|
2018-12-11 16:31:48 +01:00
|
|
|
import { goto } from '../../../__sapper__/client'
|
2018-06-08 18:00:20 +02:00
|
|
|
|
|
|
|
export default {
|
2018-12-17 20:28:31 +01:00
|
|
|
store: () => store,
|
2018-06-08 18:00:20 +02:00
|
|
|
oncreate () {
|
|
|
|
let accessToken = location.search.match(/accessToken=([^&]+)/)[1]
|
|
|
|
let instanceName = location.search.match(/instanceName=([^&]+)/)[1]
|
|
|
|
let {
|
|
|
|
loggedInInstances,
|
|
|
|
loggedInInstancesInOrder
|
2018-12-17 20:28:31 +01:00
|
|
|
} = this.store.get()
|
2018-06-08 18:00:20 +02:00
|
|
|
|
|
|
|
loggedInInstances[instanceName] = {
|
|
|
|
access_token: accessToken
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!loggedInInstancesInOrder.includes(instanceName)) {
|
|
|
|
loggedInInstancesInOrder.push(instanceName)
|
|
|
|
}
|
|
|
|
|
2018-12-17 20:28:31 +01:00
|
|
|
this.store.set({
|
2018-06-08 18:00:20 +02:00
|
|
|
currentInstance: instanceName,
|
|
|
|
loggedInInstances,
|
|
|
|
loggedInInstancesInOrder
|
|
|
|
})
|
2018-12-17 20:28:31 +01:00
|
|
|
this.store.save()
|
2018-06-08 18:00:20 +02:00
|
|
|
goto('/')
|
|
|
|
}
|
|
|
|
}
|
2018-12-11 16:31:48 +01:00
|
|
|
</script>
|