-
Notifications
You must be signed in to change notification settings - Fork 16
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
Completed #10
Closed
Closed
Completed #10
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e379041
Update Task left
jayantpranjal0 88b9739
Completed
jayantpranjal0 7502fb4
Completed
jayantpranjal0 5d03707
Some Changes Made
jayantpranjal0 fa617aa
Update package.json
jayantpranjal0 3687c08
Update package.json
jayantpranjal0 169903d
Update package.json
jayantpranjal0 862a2a5
Update package.json
jayantpranjal0 dac44ab
Update package.json
jayantpranjal0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
<template> | ||
<aside class="mx-auto flex justify-between mt-24 px-4"> | ||
<label for="add task" class="flex-1"> | ||
<input | ||
type="text" | ||
name="add task" | ||
class=" | ||
<input type="text" name="add task" class=" | ||
todo-add-task-input | ||
px-4 | ||
py-2 | ||
|
@@ -17,13 +14,9 @@ | |
outline-none | ||
focus:outline-none focus:ring | ||
w-full | ||
" | ||
placeholder="Enter Task" | ||
/> | ||
" v-model.trim="newTask" placeholder="Enter Task" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch on trimming |
||
</label> | ||
<button | ||
type="button" | ||
class=" | ||
<button type="button" class=" | ||
todo-add-task | ||
bg-transparent | ||
hover:bg-green-500 | ||
|
@@ -34,9 +27,7 @@ | |
border border-green-500 | ||
hover:border-transparent | ||
rounded | ||
" | ||
@click="addTask" | ||
> | ||
" @click="addTask"> | ||
Add Task | ||
</button> | ||
</aside> | ||
|
@@ -55,6 +46,25 @@ export default defineComponent({ | |
* @todo 2. Add the task in the dom. | ||
* @hint use emit to make a event that parent can observe | ||
*/ | ||
var newTask = this.newTask | ||
if (newTask == '') { | ||
return | ||
} | ||
this.$toast.info('Adding...') | ||
const headers = { | ||
Authorization: 'Token ' + this.$store.getters.token, | ||
} | ||
this.$axios({ | ||
headers: headers, | ||
url: 'todo/create/', | ||
method: 'post', | ||
data: { title: newTask } | ||
}).then(() => { | ||
this.$toast.success('Todo added successfully!') | ||
this.$router.go() | ||
}).catch(() => | ||
this.$toast.error('Some error occurred!') | ||
) | ||
}, | ||
}, | ||
}) | ||
|
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 |
---|---|---|
|
@@ -6,4 +6,13 @@ export default defineNuxtMiddleware((context) => { | |
* @todo Redirect the user to main page if token is present in store | ||
* @hints check what propeties context has | ||
*/ | ||
const path=context.route.fullPath | ||
const token=context.store.getters.token | ||
|
||
if (token === null && path === '/'){ | ||
context.redirect('login/'); | ||
} | ||
else if(token != null && path != '/'){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer using strict equalities |
||
context.redirect('/'); | ||
} | ||
}) |
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 |
---|---|---|
|
@@ -46,7 +46,7 @@ | |
"stylelint-config-standard": "^21.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=12", | ||
"node": "=12", | ||
"pnpm": ">=3" | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
name attribute cannot have spaces in between