()
| 12 | } |
| 13 | |
| 14 | submit () { |
| 15 | fetch(this.form.action, { |
| 16 | method: this.form.method, |
| 17 | body: new FormData(this.form) |
| 18 | }).then(async (resp) => { |
| 19 | if (!resp.ok) { |
| 20 | try { |
| 21 | const data = JSON.parse(await resp.text()) |
| 22 | |
| 23 | if (data.error) { |
| 24 | alert(data.error) |
| 25 | } |
| 26 | } catch (err) { |
| 27 | console.error(err) |
| 28 | } |
| 29 | } |
| 30 | }) |
| 31 | } |
| 32 | |
| 33 | get form () { |
| 34 | return this.querySelector('form') |
no test coverage detected