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