mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-12-06 11:22:41 +01:00
initial commit of GUI
This commit is contained in:
parent
b64ae41cd0
commit
f07b9953e3
20 changed files with 1416 additions and 0 deletions
55
src/stores/current-dir.js
Normal file
55
src/stores/current-dir.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { computed } from "vue";
|
||||
import { getFolderProperties } from "../davClient.js";
|
||||
import api from "../api.js";
|
||||
|
||||
export const useCurrentDirStore = defineStore("currentDir", {
|
||||
state: () => ({
|
||||
loading: false,
|
||||
path: "",
|
||||
organizationFolderId: null,
|
||||
organizationFolderResourceId: null,
|
||||
userManagerPermissions: null,
|
||||
}),
|
||||
actions: {
|
||||
/**
|
||||
* set the path of the current directory and fetch organization folders info from dav api
|
||||
*
|
||||
* @param {string} path current path
|
||||
*/
|
||||
async updatePath(path) {
|
||||
this.loading = true;
|
||||
this.path = path
|
||||
|
||||
let { fileInfo } = await getFolderProperties(path)
|
||||
.catch(() => {
|
||||
this.organizationFolderId = false;
|
||||
this.organizationFolderResourceId = false;
|
||||
this.userManagerPermissions = false;
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
console.log("fileInfo", fileInfo);
|
||||
|
||||
if(fileInfo) {
|
||||
this.organizationFolderId = fileInfo.organizationFolderId;
|
||||
this.organizationFolderResourceId = fileInfo.organizationFolderResourceId;
|
||||
this.userManagerPermissions = fileInfo.userManagerPermissions;
|
||||
} else {
|
||||
this.organizationFolderId = false;
|
||||
this.organizationFolderResourceId = false;
|
||||
this.userManagerPermissions = false;
|
||||
}
|
||||
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
async fetchCurrentResource() {
|
||||
if(this.organizationFolderResourceId) {
|
||||
return await api.getResource(this.organizationFolderResourceId);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue