collectionService: method for updating sharable url

This commit is contained in:
Neeraj Gupta 2022-02-28 11:54:08 +05:30
parent 2cb2511429
commit 5646fff10b
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1

View file

@ -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) {