refactor: update coll properties when syncing

This commit is contained in:
nivedin
2023-12-08 14:57:59 +05:30
committed by Andrew Bastin
parent bb8c77fa7a
commit c18e801420
7 changed files with 64 additions and 22 deletions

View File

@@ -24,7 +24,7 @@ import {
editUserRequest,
moveUserCollection,
moveUserRequest,
renameUserCollection,
updateUserCollection,
updateUserCollectionOrder,
} from "./collections.api"
@@ -155,8 +155,13 @@ export const storeSyncDefinition: StoreSyncDefinitionOf<
[collectionIndex]
)?.id
if (collectionID && collection.name) {
renameUserCollection(collectionID, collection.name)
const data = {
auth: collection.auth,
headers: collection.headers,
}
if (collectionID) {
updateUserCollection(collectionID, collection.name, JSON.stringify(data))
}
},
async addFolder({ name, path }) {
@@ -195,9 +200,12 @@ export const storeSyncDefinition: StoreSyncDefinitionOf<
)?.id
const folderName = folder.name
if (folderID && folderName) {
renameUserCollection(folderID, folderName)
const data = {
auth: folder.auth,
headers: folder.headers,
}
if (folderID) {
updateUserCollection(folderID, folderName, JSON.stringify(data))
}
},
async removeFolder({ folderID }) {