fix login
This commit is contained in:
parent
d9d50de3f6
commit
07a1d3b9c4
6 changed files with 34 additions and 35 deletions
|
|
@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
|
|||
|
||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||
|
||||
import { getAnnouncements, dismissAnnouncement } from 'src/api/user.js'
|
||||
import { dismissAnnouncement, getAnnouncements } from 'src/api/user.js'
|
||||
|
||||
const FETCH_ANNOUNCEMENT_INTERVAL_MS = 1000 * 60 * 5
|
||||
|
||||
|
|
@ -83,18 +83,17 @@ export const useAnnouncementsStore = defineStore('announcements', {
|
|||
},
|
||||
markAnnouncementAsRead(id) {
|
||||
return dismissAnnouncement({
|
||||
id,
|
||||
credentials: useOAuthStore().token,
|
||||
})
|
||||
.then(() => {
|
||||
const index = this.announcements.findIndex((a) => a.id === id)
|
||||
id,
|
||||
credentials: useOAuthStore().token,
|
||||
}).then(() => {
|
||||
const index = this.announcements.findIndex((a) => a.id === id)
|
||||
|
||||
if (index < 0) {
|
||||
return
|
||||
}
|
||||
if (index < 0) {
|
||||
return
|
||||
}
|
||||
|
||||
this.announcements[index].read = true
|
||||
})
|
||||
this.announcements[index].read = true
|
||||
})
|
||||
},
|
||||
startFetchingAnnouncements() {
|
||||
if (this.fetchAnnouncementsTimer) {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ import { defineStore } from 'pinia'
|
|||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
|
||||
import { createApp, getClientToken } from 'src/api/oauth.js'
|
||||
import { verifyCredentials } from 'src/api/public.js'
|
||||
import { createApp, getClientToken, verifyAppToken } from 'src/api/oauth.js'
|
||||
|
||||
// status codes about verifyAppToken (GET /api/v1/apps/verify_credentials)
|
||||
const isAppTokenRejected = (error) =>
|
||||
|
|
@ -39,7 +38,7 @@ export const useOAuthStore = defineStore('oauth', {
|
|||
}),
|
||||
getters: {
|
||||
token() {
|
||||
return this.userToken || this.appToken
|
||||
return this.userToken
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
|
|
@ -90,7 +89,7 @@ export const useOAuthStore = defineStore('oauth', {
|
|||
async ensureAppToken() {
|
||||
if (this.appToken) {
|
||||
try {
|
||||
await verifyCredentials({
|
||||
await verifyAppToken({
|
||||
credentials: this.appToken,
|
||||
})
|
||||
return this.appToken
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue