-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Luhana.blog list #303
base: main
Are you sure you want to change the base?
Luhana.blog list #303
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
methods: { | ||
...mapActions(['addBlog']), | ||
onSubmit(e) { | ||
e.preventDefault() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; remove this line it is unnecessary
title: '', | ||
desc: '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blog: {
title: '',
description: ''
}
this.blogPost = { | ||
title: this.title, | ||
desc: this.desc, | ||
description: 'description', | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; remove this line
desc: this.desc, | ||
description: 'description', | ||
} | ||
this.addBlog(this.blogPost) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.addBlog(this.blog)
this.title = '' | ||
this.desc = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.clearForm()
@@ -0,0 +1,33 @@ | |||
import axios from 'axios' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to import axios. nuxt provides access to axios through this.$axios
export const actions = { | ||
async fetchBlogs({ commit }) { | ||
const response = await axios.get( | ||
'https://blog-app-backend.onrender.com/api/articles/all' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have already set the baseURL
in nuxt config. so the relative url is enough. await this.$axios.get('articles/all')
No description provided.