Login, Download and visuals update

This commit is contained in:
2023-10-28 04:13:01 -05:00
parent 2b72508206
commit b3fd9637eb
16 changed files with 303 additions and 178 deletions

View File

@@ -10,6 +10,10 @@ type DirectoryData = {
[filename: string]: FileData;
};
export type FileStructure = {id: string, mtime: number, size: number, dir: DirectoryData};
type User = {
isOpenLoginModal: boolean,
isLoggedIn : boolean,
}
export type DocumentStore = {
root: FileStructure,
@@ -20,6 +24,7 @@ export type DocumentStore = {
wsWatch: WebSocket | undefined,
wsUpload: WebSocket | undefined,
selectedDocuments: Document[],
user: User,
error: string,
}
@@ -35,6 +40,7 @@ export const useDocumentStore = defineStore({
wsUpload: undefined,
selectedDocuments: [] as Document[],
error: '' as string,
user: { isLoggedIn: false, isOpenLoginModal: false } as User
}),
actions: {
@@ -140,7 +146,7 @@ export const useDocumentStore = defineStore({
for (const d of this.document) {
if ("mtime" in d) d.modified = formatUnixDate(d.mtime)
}
}
},
},
getters: {
mainDocument(): Document[] {
@@ -151,6 +157,9 @@ export const useDocumentStore = defineStore({
},
rootMain(): DirectoryData | undefined {
if(this.root) return this.root.dir
},
isUserLogged(): boolean{
return this.user.isLoggedIn
}
},
});