Cloud
Stop sharing files and folders

Stop sharing files and folders

The method secrecyClient.cloud.deleteNodeSharing attempts to stop sharing a file or folder with a specified user. It takes two parameters: nodeId (the ID of the file or folder to stop sharing) and userId (the ID of the user to stop sharing with).

cloud.ts
const stopSharingFileOrFolder = async ({
  nodeId,
  secrecyUserId,
}: {
  nodeId: string;
  secrecyUserId: string;
}): Promise<boolean> => {
  // First we need to check if the secrecyClient is available
  if (!secrecyClient) {
    return false;
  }
 
  try {
    const isSharingStop = await secrecyClient.cloud.deleteNodeSharing({
      nodeId: cloudItem.id,
      userId: secrecyUserId,
    });
 
    return isSharingStop;
  } catch (error) {
    console.error(error);
    return false;
  }
};