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