renaming gifs, adding create post element

This commit is contained in:
2025-12-10 04:43:38 +00:00
parent f5bf580abb
commit 95569c8e43
5 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<script setup>
import { ref, onMounted, computed } from "vue";
import axios from "axios";
import { useAuthStore } from "@/stores/auth";
const auth = useAuthStore();
const title = ref("");
const content = ref("");
async function post() {
try {
const res = await axios.post("/api/posts", {
title: title.value,
content: content.value,
});
title.value = "";
content.value = "";
console.log(res.data);
} catch (err) {
console.error(err);
}
}
</script>
<template>
<div v-if="auth.loggedIn">
<h1>Create Post</h1>
<input type="text" v-model="title" placeholder="Title" />
<textarea v-model="content" placeholder="Content"></textarea>
<button @click="post">Upload</button>
</div>
</template>