From 5646fff10ba3cf075b67514ef2ae68d72f8f8aa3 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Mon, 28 Feb 2022 11:54:08 +0530 Subject: [PATCH] collectionService: method for updating sharable url --- src/services/collectionService.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/services/collectionService.ts b/src/services/collectionService.ts index 83c83fe17..948d1ff67 100644 --- a/src/services/collectionService.ts +++ b/src/services/collectionService.ts @@ -22,6 +22,7 @@ import { RemoveFromCollectionRequest, CreatePublicAccessTokenRequest, PublicURL, + UpdatePublicURL, } from 'types/collection'; import { COLLECTION_SORT_BY, CollectionType } from 'constants/collection'; @@ -619,6 +620,27 @@ export const deleteShareableURL = async (collection: Collection) => { } }; +export const updateShareableURL = async (request: UpdatePublicURL) => { + try { + const token = getToken(); + if (!token) { + return null; + } + await HTTPService.put( + `${ENDPOINT}/collections/share-url/`, + request, + null, + null, + { + 'X-Auth-Token': token, + } + ); + } catch (e) { + logError(e, 'updateShareableURL failed '); + throw e; + } +}; + export const getFavCollection = async () => { const collections = await getLocalCollections(); for (const collection of collections) {