ok
This commit is contained in:
@@ -23,7 +23,7 @@ async function post() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="auth.loggedIn">
|
||||
<div v-if="auth.loggedIn" class="flex-col">
|
||||
<h1>Create Post</h1>
|
||||
<input type="text" v-model="title" placeholder="Title" />
|
||||
<textarea v-model="content" placeholder="Content"></textarea>
|
||||
|
||||
@@ -12,12 +12,13 @@ function handleLogin() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="auth.loggedIn">
|
||||
<div v-if="auth.loggedIn" class="flex-col">
|
||||
<h1>Logged in</h1>
|
||||
<p>{{ auth.user.ID }}</p>
|
||||
<p>{{ auth.user.id }}</p>
|
||||
<p>{{ auth.user.username }}</p>
|
||||
<p>{{ auth.user.admin }}</p>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-else class="flex-col">
|
||||
<h1>Create User</h1>
|
||||
<input type="text" v-model="username" placeholder="Username" />
|
||||
<input type="password" v-model="password" placeholder="Password" />
|
||||
|
||||
@@ -16,13 +16,14 @@ function handleLogout() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="auth.loggedIn">
|
||||
<div v-if="auth.loggedIn" class="flex-col">
|
||||
<h1>Logged in</h1>
|
||||
<p>{{ auth.user.ID }}</p>
|
||||
<p>{{ auth.user.id }}</p>
|
||||
<p>{{ auth.user.username }}</p>
|
||||
<p>{{ auth.user.admin }}</p>
|
||||
<button @click="handleLogout">Log Out</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-else class="flex-col">
|
||||
<h1>Login</h1>
|
||||
<input type="text" v-model="username" placeholder="Username" />
|
||||
<input type="password" v-model="password" placeholder="Password" />
|
||||
|
||||
@@ -1,26 +1,59 @@
|
||||
<template>
|
||||
<div class="flex-row">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Color</td>
|
||||
<td>Aqua</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Pet</td>
|
||||
<td>Cat</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Color</td>
|
||||
<td>Blue</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
<p class="margin1">My favs</p>
|
||||
<div class="flex-row bdr-primary">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Color</th>
|
||||
<td>Aqua</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Pet</th>
|
||||
<td>Cat</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Food</th>
|
||||
<td>Eggs</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Subject</th>
|
||||
<td>Math</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Drink</th>
|
||||
<td>Monster</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Sport</th>
|
||||
<td>Running</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Color</th>
|
||||
<td>Aqua</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Pet</th>
|
||||
<td>Cat</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Food</th>
|
||||
<td>Eggs</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Subject</th>
|
||||
<td>Math</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Drink</th>
|
||||
<td>Monster</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Sport</th>
|
||||
<td>Running</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
img {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -16,7 +16,7 @@ let len = 0;
|
||||
|
||||
async function fetchPosts() {
|
||||
try {
|
||||
const res = await axios.get("/api/posts");
|
||||
const res = await axios.get("https://www.adam-french.co.uk/api/posts");
|
||||
posts = res.data;
|
||||
len = posts.length;
|
||||
fetched.value = true;
|
||||
@@ -68,8 +68,8 @@ onMounted(() => {
|
||||
<template>
|
||||
<div v-if="fetched" class="center-content">
|
||||
<h2>{{ post.title }}</h2>
|
||||
<p>By: {{ post.author.username }}</p>
|
||||
<div>{{ post.content }}</div>
|
||||
<p>by: {{ post.author.username }}</p>
|
||||
<small
|
||||
>Created at: {{ new Date(post.createdAt).toLocaleString() }}</small
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user