♻️ (authentication)
This commit is contained in:
@@ -31,7 +31,7 @@ export default defineComponent({
|
|||||||
saveCredentials(body)
|
saveCredentials(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
router.push({ name: 'Home' })
|
router.replace({ name: 'Home' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
getMainReadme,
|
getMainReadme,
|
||||||
getUserSettingsContent
|
getUserSettingsContent
|
||||||
} from '@/modules/repo/services/repo'
|
} from '@/modules/repo/services/repo'
|
||||||
|
import { refreshToken } from '@/modules/user/service/signIn'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
@@ -13,6 +14,7 @@ interface State {
|
|||||||
files: RepoFile[]
|
files: RepoFile[]
|
||||||
readme?: string | null
|
readme?: string | null
|
||||||
userSettings?: UserSettings | null
|
userSettings?: UserSettings | null
|
||||||
|
needToLogin: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useUserRepoStore = defineStore({
|
export const useUserRepoStore = defineStore({
|
||||||
@@ -22,12 +24,14 @@ export const useUserRepoStore = defineStore({
|
|||||||
repo: '',
|
repo: '',
|
||||||
files: [],
|
files: [],
|
||||||
readme: undefined,
|
readme: undefined,
|
||||||
userSettings: undefined
|
userSettings: undefined,
|
||||||
|
needToLogin: false
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
async setUserRepo(newUser: string, newRepo: string) {
|
async setUserRepo(newUser: string, newRepo: string) {
|
||||||
this.user = newUser
|
this.user = newUser
|
||||||
this.repo = newRepo
|
this.repo = newRepo
|
||||||
|
await refreshToken()
|
||||||
const [readme, files] = await Promise.all([
|
const [readme, files] = await Promise.all([
|
||||||
getMainReadme(newUser, newRepo),
|
getMainReadme(newUser, newRepo),
|
||||||
getFiles(newUser, newRepo)
|
getFiles(newUser, newRepo)
|
||||||
|
|||||||
Reference in New Issue
Block a user