Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
T
To do list
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bui Duc Tuan
To do list
Commits
18cc2186
Commit
18cc2186
authored
Mar 09, 2022
by
Bui Duc Tuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check task exist and when page not found redirect page 404
parent
af3fd7ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
5 deletions
+36
-5
404.vue
src/components/Error/404.vue
+22
-0
editTask.vue
src/components/editTask.vue
+10
-4
routes.js
src/routes.js
+4
-1
No files found.
src/components/Error/404.vue
0 → 100644
View file @
18cc2186
<
template
>
<div
class=
"container text-center mt-5"
>
<h1>
404
</h1>
<p>
page not found.
</p>
</div>
</
template
>
<
script
>
export
default
{
}
</
script
>
<
style
scoped
>
h1
{
font-size
:
100px
;
}
p
{
font-size
:
25px
;
}
</
style
>
\ No newline at end of file
src/components/editTask.vue
View file @
18cc2186
...
...
@@ -32,17 +32,23 @@
</
template
>
<
script
>
import
Vue
from
'
vue
'
;
import
VueAlertify
from
'
vue-alertify
'
;
import
Vue
from
"
vue
"
;
import
VueAlertify
from
"
vue-alertify
"
;
Vue
.
use
(
VueAlertify
);
export
default
{
created
:
function
()
{
if
(
localStorage
.
getItem
(
"
tasks
"
))
{
this
.
tasks
=
JSON
.
parse
(
localStorage
.
getItem
(
"
tasks
"
));
}
if
(
this
.
tasks
[
this
.
id
])
{
this
.
selected
=
this
.
tasks
[
this
.
id
].
status
;
this
.
task
=
this
.
tasks
[
this
.
id
].
name
;
}
else
{
this
.
$router
.
push
(
"
/
"
);
this
.
$alertify
.
error
(
'
Task not found!
'
);
}
},
...
...
@@ -69,7 +75,7 @@ export default {
localStorage
.
setItem
(
"
tasks
"
,
JSON
.
stringify
(
this
.
tasks
));
this
.
task
=
null
;
this
.
$router
.
push
(
"
/
"
);
this
.
$alertify
.
warning
(
'
Edit task successfully
'
);
this
.
$alertify
.
warning
(
"
Edit task successfully
"
);
},
},
};
...
...
src/routes.js
View file @
18cc2186
import
Task
from
'
./components/Task.vue
'
;
import
addTask
from
'
./components/addTask.vue
'
;
import
editTask
from
'
./components/editTask.vue
'
;
import
Error404
from
'
./components/Error/404.vue
'
;
export
const
routes
=
[
{
path
:
'
/
'
,
name
:
'
Task
'
,
component
:
Task
},
{
path
:
'
/task/add
'
,
name
:
'
addTask
'
,
component
:
addTask
},
{
path
:
'
/task/edit/:id
'
,
name
:
'
editTask
'
,
component
:
editTask
}
{
path
:
'
/task/edit/:id
'
,
name
:
'
editTask
'
,
component
:
editTask
},
{
path
:
'
/404
'
,
name
:
'
Error404
'
,
component
:
Error404
},
{
path
:
'
*
'
,
redirect
:
'
/404
'
},
];
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment