Update frontend/src/services/api.js
Browse files
frontend/src/services/api.js
CHANGED
|
@@ -81,12 +81,15 @@ export async function getExtractionById(extractionId) {
|
|
| 81 |
}
|
| 82 |
|
| 83 |
/**
|
| 84 |
-
* Share an extraction with another user
|
| 85 |
* @param {number} extractionId - The extraction ID to share
|
| 86 |
-
* @param {string}
|
| 87 |
* @returns {Promise<Object>} Share result
|
| 88 |
*/
|
| 89 |
-
export async function shareExtraction(extractionId,
|
|
|
|
|
|
|
|
|
|
| 90 |
const response = await fetch(`${API_BASE_URL}/api/share`, {
|
| 91 |
method: "POST",
|
| 92 |
headers: {
|
|
@@ -95,7 +98,7 @@ export async function shareExtraction(extractionId, recipientEmail) {
|
|
| 95 |
},
|
| 96 |
body: JSON.stringify({
|
| 97 |
extraction_id: extractionId,
|
| 98 |
-
|
| 99 |
}),
|
| 100 |
});
|
| 101 |
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
/**
|
| 84 |
+
* Share an extraction with another user(s)
|
| 85 |
* @param {number} extractionId - The extraction ID to share
|
| 86 |
+
* @param {string|string[]} recipientEmails - Recipient email address(es) - can be a single email or array of emails
|
| 87 |
* @returns {Promise<Object>} Share result
|
| 88 |
*/
|
| 89 |
+
export async function shareExtraction(extractionId, recipientEmails) {
|
| 90 |
+
// Ensure recipient_emails is always an array
|
| 91 |
+
const emailsArray = Array.isArray(recipientEmails) ? recipientEmails : [recipientEmails];
|
| 92 |
+
|
| 93 |
const response = await fetch(`${API_BASE_URL}/api/share`, {
|
| 94 |
method: "POST",
|
| 95 |
headers: {
|
|
|
|
| 98 |
},
|
| 99 |
body: JSON.stringify({
|
| 100 |
extraction_id: extractionId,
|
| 101 |
+
recipient_emails: emailsArray,
|
| 102 |
}),
|
| 103 |
});
|
| 104 |
|