Add /notes/new page
This commit is contained in:
parent
eb2b7e5cdd
commit
a6913c11aa
@ -7,14 +7,13 @@
|
||||
:key="link.name"
|
||||
class="text-blue-200"
|
||||
>
|
||||
<nuxt-link
|
||||
v-if="link.url"
|
||||
:to="link.url"
|
||||
class="underline"
|
||||
>{{ link.name }}</nuxt-link
|
||||
>
|
||||
<button v-else class="underline" @click="link.action">
|
||||
{{ link.name }}
|
||||
<nuxt-link :to="link.url" class="underline">{{
|
||||
link.name
|
||||
}}</nuxt-link>
|
||||
</li>
|
||||
<li class="text-blue-200">
|
||||
<button class="underline" @click="logout">
|
||||
Sign Out
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
@ -35,11 +34,11 @@ export default {
|
||||
{ url: '/signin', name: 'Sign In' },
|
||||
{ url: '/register', name: 'Register' },
|
||||
{ url: '/notes', name: 'Notes' },
|
||||
{ action: 'logout', name: 'Sign Out' },
|
||||
{ url: '/404', name: '404' },
|
||||
],
|
||||
}),
|
||||
options: {
|
||||
auth: false, // FIXME: auth: 'guest'
|
||||
auth: false,
|
||||
},
|
||||
methods: {
|
||||
async logout() {
|
||||
@ -49,5 +48,3 @@ export default {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
<template>
|
||||
<div class="container p-4 mx-auto bg-gray-800">
|
||||
<h1 class="text-center">My Notes</h1>
|
||||
<nuxt-link
|
||||
to="/notes/new"
|
||||
class="bg-blue-700 hover:bg-blue-500 text-white font-bold py-2 px-4 rounded"
|
||||
>New note</nuxt-link
|
||||
>
|
||||
<input
|
||||
id="search"
|
||||
name="search"
|
||||
|
||||
44
frontend/pages/notes/new.vue
Normal file
44
frontend/pages/notes/new.vue
Normal file
@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<div class="container mx-auto">
|
||||
<form @submit.prevent="submit">
|
||||
<textarea
|
||||
v-model="content"
|
||||
aria-label="markdown input"
|
||||
name="content"
|
||||
rows="30"
|
||||
style="outline: none !important;"
|
||||
class="w-full bg-gray-800 p-5"
|
||||
spellcheck="false"
|
||||
></textarea>
|
||||
<button
|
||||
class="block bg-blue-700 hover:bg-blue-500 text-white font-bold py-2 px-4 rounded"
|
||||
type="submit"
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'New',
|
||||
data: () => ({
|
||||
title: 'Test',
|
||||
tags: [],
|
||||
content: '',
|
||||
}),
|
||||
methods: {
|
||||
...mapActions('notes', ['create']),
|
||||
submit() {
|
||||
this.create({
|
||||
title: this.title,
|
||||
tags: this.tags,
|
||||
content: this.content,
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Loading…
x
Reference in New Issue
Block a user