Fix add folder to collections being broken when logged in (#1299)
* Moved add folder modal logic out * Pass around folder paths for collections to fix folder not applying on logged in users * Remove unwanted use of folder value for addFolder store mutation Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
@@ -206,14 +206,21 @@ export const mutations = {
|
||||
},
|
||||
|
||||
addFolder({ collections }, payload) {
|
||||
const { name, folder } = payload
|
||||
const { name, path } = payload
|
||||
|
||||
const newFolder = {
|
||||
name: name,
|
||||
requests: [],
|
||||
folders: [],
|
||||
}
|
||||
folder.folders.push(newFolder)
|
||||
|
||||
// Walk from collections to destination with the path
|
||||
const indexPaths = path.split("/").map((x) => parseInt(x))
|
||||
|
||||
let target = collections[indexPaths.shift()]
|
||||
while (indexPaths.length > 0) target = target.folders[indexPaths.shift()]
|
||||
|
||||
target.folders.push(newFolder)
|
||||
},
|
||||
|
||||
editFolder({ collections }, payload) {
|
||||
|
||||
Reference in New Issue
Block a user