(filePath, password)
| 493 | }; |
| 494 | } |
| 495 | async function onClickSaveFileShare(filePath, password) { |
| 496 | if (isAdding.value) { |
| 497 | return; |
| 498 | } |
| 499 | if (!filePath) { |
| 500 | return; |
| 501 | } |
| 502 | isAdding.value = true; |
| 503 | try { |
| 504 | const requestBody = { |
| 505 | pathInView: path.value, |
| 506 | filePath, |
| 507 | password |
| 508 | }; |
| 509 | const response = await fetch(`/api/files/create-share`, { |
| 510 | method: 'POST', |
| 511 | body: JSON.stringify(requestBody) |
| 512 | }); |
| 513 | if (!response.ok) { |
| 514 | throw new Error(`Failed to create share. ${response.statusText} ${await response.text()}`); |
| 515 | } |
| 516 | const result = await response.json(); |
| 517 | if (!result.success) { |
| 518 | throw new Error('Failed to create share!'); |
| 519 | } |
| 520 | directories.value = [...result.newDirectories]; |
| 521 | files.value = [...result.newFiles]; |
| 522 | createShareModal.value = null; |
| 523 | onClickOpenManageShare(result.createdFileShareId); |
| 524 | } catch (error) { |
| 525 | console.error(error); |
| 526 | } |
| 527 | isAdding.value = false; |
| 528 | } |
| 529 | function onClickCloseFileShare() { |
| 530 | createShareModal.value = null; |
| 531 | } |
nothing calls this directly
no test coverage detected