From 83019733e312e71cbe3ef1fed1b9cdaf3765120d Mon Sep 17 00:00:00 2001 From: nivedin Date: Fri, 8 Dec 2023 15:01:33 +0530 Subject: [PATCH] refactor: update gql properties sync --- .../collections/gqlCollections.sync.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/hoppscotch-selfhost-web/src/platform/collections/gqlCollections.sync.ts b/packages/hoppscotch-selfhost-web/src/platform/collections/gqlCollections.sync.ts index d65970dcc..b737d3908 100644 --- a/packages/hoppscotch-selfhost-web/src/platform/collections/gqlCollections.sync.ts +++ b/packages/hoppscotch-selfhost-web/src/platform/collections/gqlCollections.sync.ts @@ -21,7 +21,7 @@ import { deleteUserCollection, deleteUserRequest, editGQLUserRequest, - renameUserCollection, + updateUserCollection, } from "./collections.api" import * as E from "fp-ts/Either" @@ -158,8 +158,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 }) { @@ -197,8 +202,13 @@ export const storeSyncDefinition: StoreSyncDefinitionOf< path.split("/").map((index) => parseInt(index)) )?.id - if (folderBackendId && folder.name) { - renameUserCollection(folderBackendId, folder.name) + const data = { + auth: folder.auth, + headers: folder.headers, + } + + if (folderBackendId) { + updateUserCollection(folderBackendId, folder.name, JSON.stringify(data)) } }, async removeFolder({ folderID }) {