|
Lines 32-38
Link Here
|
| 32 |
|
32 |
|
| 33 |
<script> |
33 |
<script> |
| 34 |
import { APIClient } from "../../fetch/api-client.js" |
34 |
import { APIClient } from "../../fetch/api-client.js" |
| 35 |
import { setMessage, setError } from "../../messages" |
35 |
import { setMessage } from "../../messages" |
| 36 |
|
36 |
|
| 37 |
export default { |
37 |
export default { |
| 38 |
data() { |
38 |
data() { |
|
Lines 59-90
export default {
Link Here
|
| 59 |
}, |
59 |
}, |
| 60 |
onSubmit(e) { |
60 |
onSubmit(e) { |
| 61 |
e.preventDefault() |
61 |
e.preventDefault() |
| 62 |
|
62 |
const client = APIClient.erm |
| 63 |
let apiUrl = |
63 |
client.localTitles.delete(this.title.title_id).then( |
| 64 |
"/api/v1/erm/eholdings/local/titles/" + this.title.title_id |
64 |
success => { |
| 65 |
|
65 |
setMessage(this.$__("Title deleted")) |
| 66 |
const options = { |
66 |
this.$router.push( |
| 67 |
method: "DELETE", |
67 |
"/cgi-bin/koha/erm/eholdings/local/titles" |
| 68 |
headers: { |
68 |
) |
| 69 |
"Content-Type": "application/json;charset=utf-8", |
|
|
| 70 |
}, |
69 |
}, |
| 71 |
} |
70 |
error => {} |
| 72 |
|
71 |
) |
| 73 |
fetch(apiUrl, options) |
|
|
| 74 |
.then(response => checkError(response, 1)) |
| 75 |
.then(response => { |
| 76 |
if (response.status == 204) { |
| 77 |
setMessage(this.$__("Title deleted")) |
| 78 |
this.$router.push( |
| 79 |
"/cgi-bin/koha/erm/eholdings/local/titles" |
| 80 |
) |
| 81 |
} else { |
| 82 |
setError(response.message || response.statusText) |
| 83 |
} |
| 84 |
}) |
| 85 |
.catch(error => { |
| 86 |
setError(error) |
| 87 |
}) |
| 88 |
}, |
72 |
}, |
| 89 |
}, |
73 |
}, |
| 90 |
name: "EHoldingsLocalTitlesFormConfirmDelete", |
74 |
name: "EHoldingsLocalTitlesFormConfirmDelete", |
| 91 |
- |
|
|