Better special handling for root Document. Restore live updates of relative modified times.
This commit is contained in:
parent
540e825cc3
commit
2978e0c968
|
@ -4,6 +4,7 @@ import { defineStore } from 'pinia'
|
|||
import { collator } from '@/utils'
|
||||
import { logoutUser } from '@/repositories/User'
|
||||
import { watchConnect } from '@/repositories/WS'
|
||||
import { format } from 'path'
|
||||
|
||||
type FileData = { id: string; mtime: number; size: number; dir: DirectoryData }
|
||||
type DirectoryData = {
|
||||
|
@ -39,11 +40,10 @@ export const useDocumentStore = defineStore({
|
|||
const docs = []
|
||||
let loc = [] as string[]
|
||||
for (const [level, name, key, mtime, size, isfile] of root) {
|
||||
if (level === 0) continue
|
||||
loc = loc.slice(0, level - 1)
|
||||
docs.push({
|
||||
name,
|
||||
loc: loc.join('/'),
|
||||
loc: level ? loc.join('/') : '/',
|
||||
key,
|
||||
size,
|
||||
sizedisp: formatSize(size),
|
||||
|
@ -57,6 +57,9 @@ export const useDocumentStore = defineStore({
|
|||
console.log("Documents", docs)
|
||||
this.document = docs as Document[]
|
||||
},
|
||||
updateModified() {
|
||||
for (const doc of this.document) doc.modified = formatUnixDate(doc.mtime)
|
||||
},
|
||||
login(username: string, privileged: boolean) {
|
||||
this.user.username = username
|
||||
this.user.privileged = privileged
|
||||
|
|
Loading…
Reference in New Issue
Block a user