|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
import { PadStore } from "./PadStore.js";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
setup() {
|
|
|
|
|
const { ref, computed } = Vue;
|
|
|
|
@ -25,16 +27,21 @@ export default {
|
|
|
|
|
link.value = newPad();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const pad = {
|
|
|
|
|
title: title.value.trim(),
|
|
|
|
|
link: link.value,
|
|
|
|
|
overview: overview.value,
|
|
|
|
|
categories: categories.value,
|
|
|
|
|
date: date.value,
|
|
|
|
|
};
|
|
|
|
|
PadStore.value.unshift(pad);
|
|
|
|
|
|
|
|
|
|
pad.categories.join(", ");
|
|
|
|
|
|
|
|
|
|
fetch("api", {
|
|
|
|
|
method: "POST",
|
|
|
|
|
headers: { "Content-Type": "application/json" },
|
|
|
|
|
body: JSON.stringify({
|
|
|
|
|
title: title.value.trim(),
|
|
|
|
|
link: link.value,
|
|
|
|
|
overview: overview.value,
|
|
|
|
|
categories: categories.value.join(", "),
|
|
|
|
|
date: date.value,
|
|
|
|
|
}),
|
|
|
|
|
body: JSON.stringify(pad),
|
|
|
|
|
});
|
|
|
|
|
sent.value = true;
|
|
|
|
|
|
|
|
|
@ -45,7 +52,18 @@ export default {
|
|
|
|
|
date.value = null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return { title, link, overview, categories, date, submit, newPad, sent, disabled };
|
|
|
|
|
return {
|
|
|
|
|
title,
|
|
|
|
|
link,
|
|
|
|
|
overview,
|
|
|
|
|
categories,
|
|
|
|
|
date,
|
|
|
|
|
submit,
|
|
|
|
|
newPad,
|
|
|
|
|
sent,
|
|
|
|
|
disabled,
|
|
|
|
|
PadStore,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
template: `
|
|
|
|
@ -61,6 +79,7 @@ export default {
|
|
|
|
|
<input class='date' type="date" v-model="date" placeholder="Date" />
|
|
|
|
|
|
|
|
|
|
<button @click="submit" class="submit">Insert</button>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|