|
|
@ -13,12 +13,23 @@ export default {
|
|
|
|
return [title, overview, overview, categories].some((input) => input.value == "");
|
|
|
|
return [title, overview, overview, categories].some((input) => input.value == "");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const newPad = function () {
|
|
|
|
|
|
|
|
let name = title.value.trim().replaceAll(" ", "_");
|
|
|
|
|
|
|
|
let url = `https://pad.xpub.nl/p/${name}`;
|
|
|
|
|
|
|
|
window.open(url);
|
|
|
|
|
|
|
|
return url;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const submit = function () {
|
|
|
|
const submit = function () {
|
|
|
|
|
|
|
|
if (link.value == "") {
|
|
|
|
|
|
|
|
link.value = newPad();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fetch("https://hub.xpub.nl/soupboat/padliography/", {
|
|
|
|
fetch("https://hub.xpub.nl/soupboat/padliography/", {
|
|
|
|
method: "POST",
|
|
|
|
method: "POST",
|
|
|
|
headers: { "Content-Type": "application/json" },
|
|
|
|
headers: { "Content-Type": "application/json" },
|
|
|
|
body: JSON.stringify({
|
|
|
|
body: JSON.stringify({
|
|
|
|
title: title.value,
|
|
|
|
title: title.value.trim(),
|
|
|
|
link: link.value,
|
|
|
|
link: link.value,
|
|
|
|
overview: overview.value,
|
|
|
|
overview: overview.value,
|
|
|
|
categories: categories.value,
|
|
|
|
categories: categories.value,
|
|
|
@ -34,7 +45,7 @@ export default {
|
|
|
|
date.value = null;
|
|
|
|
date.value = null;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return { title, link, overview, categories, date, submit, sent, disabled };
|
|
|
|
return { title, link, overview, categories, date, submit, newPad, sent, disabled };
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
template: `
|
|
|
|
template: `
|
|
|
|