login/logout/register woes
This commit is contained in:
parent
a392f8e4a9
commit
556a37e836
11 changed files with 29 additions and 21 deletions
|
|
@ -135,9 +135,9 @@ export default {
|
|||
this.showConfirmLogout()
|
||||
}
|
||||
},
|
||||
doLogout() {
|
||||
async doLogout() {
|
||||
await useUsersStore().logout()
|
||||
this.$router.replace('/main/public')
|
||||
useUsersStore().logout()
|
||||
this.hideConfirmLogout()
|
||||
},
|
||||
onSearchBarToggled(hidden) {
|
||||
|
|
|
|||
|
|
@ -145,9 +145,9 @@ const MobileNav = {
|
|||
}
|
||||
},
|
||||
doLogout() {
|
||||
this.$router.replace('/main/public')
|
||||
useUsersStore().logout()
|
||||
this.hideConfirmLogout()
|
||||
this.$router.replace('/main/public')
|
||||
},
|
||||
markNotificationsAsSeen() {
|
||||
useNotificationsStore().markNotificationsAsSeen()
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ const oac = {
|
|||
clientSecret,
|
||||
instance: useInstanceStore().server,
|
||||
code: this.code,
|
||||
}).then(({ data: result }) => {
|
||||
}).then(async ({ data: result }) => {
|
||||
oauthStore.setToken(result.access_token)
|
||||
|
||||
useUsersStore().loginUser(result.access_token)
|
||||
await useUsersStore().loginUser(result.access_token)
|
||||
this.$router.push({ name: 'friends' })
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@
|
|||
<!-- eslint-enable vue/no-v-html -->
|
||||
</div>
|
||||
<div
|
||||
v-if="serverValidationErrors.length"
|
||||
v-if="signUpErrors.length"
|
||||
class="form-group"
|
||||
>
|
||||
<div class="alert error">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<template>
|
||||
<div :class="['Timeline', classes.root]">
|
||||
<!-- there is a brief moment during logout when old timeline gets forcibly deactivated -->
|
||||
<div v-if="timeline.fetcher" :class="['Timeline', classes.root]">
|
||||
{{ timelineRef }}
|
||||
<div
|
||||
v-if="!embedded"
|
||||
:class="classes.header"
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ export const useAuthFlowStore = defineStore('authFlow', {
|
|||
this.settings = {}
|
||||
},
|
||||
async login({ access_token: accessToken }) {
|
||||
useOAuthStore().setToken(accessToken)
|
||||
useUsersStore().loginUser(accessToken, { root: true })
|
||||
await useOAuthStore().setToken(accessToken)
|
||||
await useUsersStore().loginUser(accessToken, { root: true })
|
||||
this.resetState()
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export const useOAuthStore = defineStore('oauth', {
|
|||
this.userToken = token
|
||||
},
|
||||
clearToken() {
|
||||
this.userToken = false
|
||||
this.userToken = null
|
||||
},
|
||||
async createApp() {
|
||||
const instance = useInstanceStore().server
|
||||
|
|
|
|||
|
|
@ -180,7 +180,6 @@ export const useStreamingStore = defineStore('streaming', {
|
|||
case 'delete':
|
||||
return [data.id]
|
||||
default:
|
||||
console.log('UNKNOWN', eventName, eventStream, data)
|
||||
return data
|
||||
}
|
||||
})()
|
||||
|
|
|
|||
|
|
@ -258,14 +258,24 @@ export const useTimelinesStore = defineStore('timelines', {
|
|||
timeline.fetcher.startFetching()
|
||||
},
|
||||
stopFetchingTimeline(timelineName, reason) {
|
||||
console.debug(
|
||||
'[Timelines] Stopped fetching timeline',
|
||||
timelineName,
|
||||
'Reason:',
|
||||
reason,
|
||||
)
|
||||
const timeline = this[timelineName]
|
||||
timeline.fetcher.stopFetching()
|
||||
if (timeline.fetcher === null) {
|
||||
console.debug(
|
||||
'[Timelines] Already inactive timeline',
|
||||
timelineName,
|
||||
'Reason:',
|
||||
reason,
|
||||
)
|
||||
return
|
||||
} else {
|
||||
timeline.fetcher.stopFetching()
|
||||
console.debug(
|
||||
'[Timelines] Stopped fetching timeline',
|
||||
timelineName,
|
||||
'Reason:',
|
||||
reason,
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
// Queues & Timeline manip
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ describe('Timelines store', () => {
|
|||
const sub = vi.fn()
|
||||
useStreamingStore().addSubscriber = sub
|
||||
|
||||
console.log(store.activate)
|
||||
store.activate('friends', undefined, true)
|
||||
|
||||
expect(sub).to.have.been.called
|
||||
|
|
@ -34,7 +33,6 @@ describe('Timelines store', () => {
|
|||
const sub = vi.fn()
|
||||
useStreamingStore().addSubscriber = sub
|
||||
|
||||
console.log(store.activate)
|
||||
store.activate('user', '1')
|
||||
|
||||
expect(sub).to.not.have.been.called
|
||||
|
|
|
|||
|
|
@ -1095,7 +1095,6 @@ describe('Users store', () => {
|
|||
const store = useUsersStore()
|
||||
const { storeAction, apiUrl } = actionKeys(action)
|
||||
await store[storeAction](userId)
|
||||
console.log(apiUrl)
|
||||
|
||||
expect(mockFetch).to.have.been.calledWith(
|
||||
USER_API[apiUrl](userId),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue