(e)
| 15 | constructor(private onClose: () => void, private state: ExportModalState) {} |
| 16 | |
| 17 | async submit(e) { |
| 18 | e.preventDefault() |
| 19 | const data = getFormData(e) |
| 20 | switch (data.submit) { |
| 21 | case "toPool": |
| 22 | exportToPool(data) |
| 23 | this.close() |
| 24 | return |
| 25 | case "toFile": |
| 26 | if (await exportToFile(data.format)) this.close() |
| 27 | return |
| 28 | case "toClipboard": |
| 29 | this.state.setIsCopying(true) |
| 30 | try { |
| 31 | await exportToClipboard(data.format) |
| 32 | } catch (e) { |
| 33 | if (isAbortError(e)) return |
| 34 | } finally { |
| 35 | this.state.setIsCopying(false) |
| 36 | } |
| 37 | return |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | close() { |
| 42 | this.onClose() |
no test coverage detected