-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1 feat(article): Added article page and links to post
- Loading branch information
Showing
4 changed files
with
112 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<template> | ||
<v-app> | ||
<v-app-bar class="cyan accent-3 color" flat app> | ||
<nuxt-link to="/"> | ||
<v-toolbar-title class="text-uppercase">Artic</v-toolbar-title> | ||
</nuxt-link> | ||
|
||
<v-spacer></v-spacer> | ||
|
||
<div v-if="$auth.loggedIn"> | ||
<v-btn @click="$auth.logout()">Logout</v-btn> | ||
<nuxt-link to="/dashboard"> | ||
<v-btn>Dashboard</v-btn> | ||
</nuxt-link> | ||
</div> | ||
<nuxt-link to="/login" v-else> | ||
<v-btn>Login</v-btn> | ||
</nuxt-link> | ||
</v-app-bar> | ||
<v-main> | ||
<v-content> | ||
<nuxt /> | ||
</v-content> | ||
</v-main> | ||
</v-app> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data: () => ({}) | ||
} | ||
</script> | ||
|
||
<style> | ||
.color a { | ||
color: black; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<v-container> | ||
<v-row> | ||
<article-post | ||
:articleTitle="article.title" | ||
:articleSlug="article.slug" | ||
:articleAuthor="article.author.name" | ||
:articleBody="article.body" | ||
:articleTags="article.tags" | ||
/> | ||
</v-row> | ||
</v-container> | ||
</template> | ||
|
||
<script> | ||
import ArticlePost from '@/components/ArticlePost' | ||
export default { | ||
layout: 'article', | ||
components: { | ||
ArticlePost | ||
}, | ||
mounted() { | ||
this.loadArticle() | ||
}, | ||
data: () => ({ | ||
loading: false, | ||
article: { | ||
author: {} // defined author because :artucleAuthor won't accept undefined | ||
}, | ||
tags: [] | ||
}), | ||
computed: { | ||
params() { | ||
return this.$route.params | ||
} | ||
}, | ||
methods: { | ||
async loadArticle() { | ||
this.loading = true | ||
await this.$axios | ||
.get(`articles/${this.params.slug}`) | ||
.then((response) => { | ||
console.log(response.data) | ||
this.article = response.data | ||
this.loading = false | ||
}) | ||
.catch((err) => { | ||
console.log(err.response) | ||
this.loading = false | ||
}) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters