72 lines
1.1 KiB
Vue
72 lines
1.1 KiB
Vue
<template>
|
|
<div class="content">
|
|
<a
|
|
href="/"
|
|
class="link"
|
|
>Go back home</a>
|
|
|
|
<h3>{{ shuck }}</h3>
|
|
|
|
<form
|
|
class="form compose"
|
|
@submit.prevent="submitPost"
|
|
>
|
|
<div class="form-row">
|
|
<input
|
|
v-model="title"
|
|
placeholder="Title"
|
|
class="input"
|
|
>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<input
|
|
v-model="link"
|
|
class="input"
|
|
placeholder="Link"
|
|
>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<textarea
|
|
v-model="body"
|
|
placeholder="Body"
|
|
class="input body"
|
|
/>
|
|
</div>
|
|
|
|
<div class="form-actions">
|
|
<button class="button button-submit">Post</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref } from 'vue';
|
|
|
|
const shuck = 'Eratic';
|
|
|
|
// const route = useRoute();
|
|
// const res = await useFetch(`/api/shucks/${route.params.id}/posts`);
|
|
|
|
const title = ref();
|
|
const link = ref();
|
|
const body = ref();
|
|
|
|
async function submitPost() {
|
|
console.log('POST', link.value);
|
|
|
|
/*
|
|
await useFetch(`/api/shucks/${route.params.id}/posts`, {
|
|
method: 'post',
|
|
body: {
|
|
title,
|
|
link,
|
|
body,
|
|
},
|
|
});
|
|
*/
|
|
}
|
|
</script>
|