Skip to content

Csoc week3 #7

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

abhishek-sultaniya
Copy link

@abhishek-sultaniya abhishek-sultaniya commented Jun 29, 2022

Tasks

  • Auth Middleware
  • Login Function
  • Add task
  • Get tasks
  • Update Task
  • Delete Task
  • UI Improvement

Repo Deployment

Some points to note.

  • The CSS properties were not working on local host but now its working on the deployed link.
  • There is Bug in logout.Sometimes we have to refresh after logout.
  • Added username on navbar when user logs in.
  • I was facing error in toggling update tasks,so corrections are welcome.

Copy link
Member

@IamEzio IamEzio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall a good PR. Nice work!
The functionality seems to be working fine -- however, there are a few glitches, and CSS is to be improved. Some important takeaways:

  • Remove console log statements before submitting PR.
  • Always make changes in a separate feature branch and keep your origin/main the same as upstream/main.
  • Run an indentation check on the whole PR. Bad indentation makes the code difficult to read and understand.
  • Toasts raised to the User should be apt and descriptive of the situation. Prompt hum wherever necessary to try again when an error occurs.
  • Work on building a better UI.

@@ -3,6 +3,7 @@
<label for="add task" class="flex-1">
<input
type="text"
v-model.trim="inputText"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch on using trim.

@@ -35,6 +36,7 @@
hover:border-transparent
rounded
"
id="addbtn"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use camel case naming convention.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok,next time I will keep it in mind.

/**
* @todo Complete this function.
* @todo 1. Send the request to add the task to the backend server.
* @todo 2. Add the task in the dom.
* @hint use emit to make a event that parent can observe
*/
console.log("debyg");
console.log(this.inputText);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all console log statements before submitting PR.
Ditto below.

Copy link
Author

@abhishek-sultaniya abhishek-sultaniya Jul 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok,Should i comment all console logs or erase it?

Sometimes I have to use it for debugging.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to remove all console log statements before submitting PRs. When you submit code to a larger repo which is open-source, you don't want these unnecessary statements to sneak into the codebase.


if(this.inputText=='')
{
this.$toast.error('Cannot Add empty Todo');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation and capitalize the error message properly. Ditto below

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From next time I would use prettier.Will that be fine?

I will keep it in mind.
Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, using prettier is fine. However, a habit of writing clean code goes a long way.

this.$emit('newTask')
})
.catch((err) => {
this.$toast.error("Unable to add task!..")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good error callback would be to prompt the user to try again later.

@@ -108,37 +117,60 @@ import { defineComponent } from '@nuxtjs/composition-api'
import addTask from '~/components/addTask.vue'

export default defineComponent({
middleware: 'auth',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation.

},

getname(){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow proper naming conventions.

*/
this.loading = true;
const headers={
Authorization: 'Token ' + this.$store.getters.token
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation. Ditto below

@@ -147,25 +179,69 @@ export default defineComponent({
* @todo 1. Send the request to update the task to the backend server.
* @todo 2. Update the task in the dom.
*/
updateTask(_index, _id) {},
async updateTask(_index, _id) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method should have added some checks to ensure that the new ToDo isn't empty and is not the same as the original one. Accordingly, the necessary toasts should be raised to inform the user.

}
$toast.info('Please wait...')

$axios
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation.

this.$toast.error("Error!..")
})
}
this.todos[_index].editing = !this.todos[_index].editing;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you adding this here? This is already present on line 199. This might be the reason you are facing difficulties while updating todos.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will look it,by mistake during trial I might have added it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants