45 lines
709 B
JavaScript
45 lines
709 B
JavaScript
console.log("revisions.js loaded")
|
|
|
|
async function restoreRevision(
|
|
revisionUUID,
|
|
) {
|
|
|
|
if (
|
|
!confirm(
|
|
"restore revision?"
|
|
)
|
|
) {
|
|
return
|
|
}
|
|
|
|
const res = await fetch(
|
|
"/_/api/v1/revisions/restore",
|
|
{
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type":
|
|
"application/json",
|
|
},
|
|
body: JSON.stringify({
|
|
revision_uuid:
|
|
revisionUUID,
|
|
}),
|
|
},
|
|
)
|
|
|
|
if (!res.ok) {
|
|
|
|
alert(
|
|
"restore failed",
|
|
)
|
|
|
|
return
|
|
}
|
|
|
|
alert(
|
|
"revision restored",
|
|
)
|
|
|
|
location.reload()
|
|
}
|