Implement proper login/logout UI, fix breadcrumbs on file listing.
This commit is contained in:
@@ -3,7 +3,6 @@ import type {
|
||||
DirEntry,
|
||||
FileEntry,
|
||||
FUID,
|
||||
DirList,
|
||||
SelectedItems
|
||||
} from '@/repositories/Document'
|
||||
import { formatSize, formatUnixDate, haystackFormat } from '@/utils'
|
||||
@@ -67,8 +66,10 @@ export const useDocumentStore = defineStore({
|
||||
// Recurse but replace recursive structure with boolean
|
||||
loc = doc.loc ? `${doc.loc}/${doc.name}` : doc.name
|
||||
queue.push(...Object.entries(doc.dir).map(mapper))
|
||||
// @ts-ignore
|
||||
doc.dir = true
|
||||
}
|
||||
// @ts-ignore
|
||||
else doc.dir = false
|
||||
}
|
||||
// Pre sort directory entries folders first then files, names in natural ordering
|
||||
@@ -77,7 +78,7 @@ export const useDocumentStore = defineStore({
|
||||
b.dir - a.dir ||
|
||||
collator.compare(a.name, b.name)
|
||||
)
|
||||
this.document = docs
|
||||
this.document = docs as Document[]
|
||||
},
|
||||
updateUploadingDocuments(key: number, progress: number) {
|
||||
for (const d of this.uploadingDocuments) {
|
||||
@@ -107,6 +108,12 @@ export const useDocumentStore = defineStore({
|
||||
this.user.privileged = privileged
|
||||
this.user.isLoggedIn = true
|
||||
this.user.isOpenLoginModal = false
|
||||
},
|
||||
async logout() {
|
||||
const res = await fetch('/logout', { method: 'POST' })
|
||||
if (!res.ok) throw Error(`Logout failed: ${res.statusText}`)
|
||||
this.$reset()
|
||||
history.go() // Reload page
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
|
||||
Reference in New Issue
Block a user