Sep 1, 2024, 12:02 AM
This commit is contained in:
@@ -17,7 +17,6 @@ interface State {
|
|||||||
user: string
|
user: string
|
||||||
repo: string
|
repo: string
|
||||||
files: RepoFile[]
|
files: RepoFile[]
|
||||||
isReadmeOffline: boolean
|
|
||||||
readme?: string | null
|
readme?: string | null
|
||||||
userSettings?: UserSettings | null
|
userSettings?: UserSettings | null
|
||||||
needToLogin: boolean
|
needToLogin: boolean
|
||||||
@@ -29,14 +28,12 @@ export const useUserRepoStore = defineStore({
|
|||||||
user: '',
|
user: '',
|
||||||
repo: '',
|
repo: '',
|
||||||
files: [],
|
files: [],
|
||||||
isReadmeOffline: true,
|
|
||||||
readme: undefined,
|
readme: undefined,
|
||||||
userSettings: undefined,
|
userSettings: undefined,
|
||||||
needToLogin: false
|
needToLogin: false
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
async setUserRepo(user: string, repo: string) {
|
async setUserRepo(user: string, repo: string) {
|
||||||
this.isReadmeOffline = true
|
|
||||||
this.user = user
|
this.user = user
|
||||||
this.repo = repo
|
this.repo = repo
|
||||||
|
|
||||||
@@ -88,20 +85,10 @@ export const useUserRepoStore = defineStore({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
getCachedMainReadme(user, repo)
|
getCachedMainReadme(user, repo).then(async (cachedReadme) => {
|
||||||
.then((readme) => {
|
this.readme = cachedReadme
|
||||||
this.readme = readme
|
this.readme = await getMainReadme(user, repo)
|
||||||
})
|
})
|
||||||
.then(() => getMainReadme(user, repo))
|
|
||||||
.then((readme) => {
|
|
||||||
this.readme = readme
|
|
||||||
|
|
||||||
// if the offline state is too fast,
|
|
||||||
// it gives an impression of glitch.
|
|
||||||
setTimeout(() => {
|
|
||||||
this.isReadmeOffline = false
|
|
||||||
}, 350)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
addFile(file: RepoFile) {
|
addFile(file: RepoFile) {
|
||||||
const savedRepoId = data.generateId(
|
const savedRepoId = data.generateId(
|
||||||
|
|||||||
Reference in New Issue
Block a user