Added basic shack creation.

This commit is contained in:
2023-06-03 23:32:50 +02:00
parent bc9fec207b
commit de757efc6e
23 changed files with 274 additions and 216 deletions

View File

@@ -21,5 +21,22 @@
class="link"
>Sign up</a></li>
</ul>
<ul>
<li
v-for="shelf in shelves"
:key="shelf.id"
><a
:href="`/s/${shelf.slug}`"
class="link"
>{{ shelf.slug }}</a></li>
</ul>
</div>
</template>
<script setup>
import { usePageContext } from '../../renderer/usePageContext';
const { pageData } = usePageContext();
const { shelves } = pageData;
</script>

View File

@@ -1,71 +0,0 @@
<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>