Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fitmin
web
Commits
a07f0a80
Commit
a07f0a80
authored
5 years ago
by
JunGu Kang
Browse files
Options
Downloads
Patches
Plain Diff
Implement Logout Feature and Display Logout Button on AppBar
parent
37fdbaad
No related branches found
No related tags found
2 merge requests
!37
Deploy
,
!9
#7 Implement Logout Feature and Display Logout Button on AppBar
Pipeline
#4119
passed
5 years ago
Stage: lint
Stage: test
Stage: build
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/LoginForm.vue
+1
-1
1 addition, 1 deletion
src/components/LoginForm.vue
src/components/NavigationBar.vue
+25
-0
25 additions, 0 deletions
src/components/NavigationBar.vue
src/settings/api.js
+1
-1
1 addition, 1 deletion
src/settings/api.js
with
27 additions
and
2 deletions
src/components/LoginForm.vue
+
1
−
1
View file @
a07f0a80
...
...
@@ -80,7 +80,7 @@ export default {
if
([
200
,
201
,
400
,
404
].
includes
(
res
.
status
))
{
return
Promise
.
all
([
res
.
json
(),
res
]);
}
// If response status is not equal to 200 or 404, go to catch.
// If response status is not equal to 200
, 201, 400,
or 404, go to catch.
throw
new
Error
(
'
알 수 없는 응답입니다.
'
);
})
.
then
((
values
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/components/NavigationBar.vue
+
25
−
0
View file @
a07f0a80
...
...
@@ -11,16 +11,26 @@
<v-toolbar-title>
FITMIN
</v-toolbar-title>
<v-spacer></v-spacer>
<span
class=
"mr-3"
v-if=
"isLogin"
>
{{
loginUser
.
name
}}{{
loginUser
.
nickname
?
`(${loginUser.nickname
}
)`
:
''
}}
트레이너
<
/span
>
<
v
-
btn
icon
v
-
if
=
"
isLogin
"
@
click
=
"
doLogout
"
>
<
v
-
icon
>
mdi
-
logout
<
/v-icon
>
<
/v-btn
>
<
/v-app-bar
>
<
/template
>
<
script
>
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
APISetting
from
'
@/settings/api
'
;
export
default
{
name
:
'
NavigationBar
'
,
...
...
@@ -38,8 +48,23 @@ export default {
}
,
methods
:
{
doLogout
()
{
fetch
(
APISetting
.
endpoints
.
auth
.
logout
,
APISetting
.
settings
.
post
(
null
))
.
then
((
res
)
=>
{
if
(
res
.
status
===
204
)
{
this
.
setLogout
();
this
.
$router
.
push
(
'
/
'
);
}
// If response status is not equal to 204, go to catch.
throw
new
Error
(
'
알 수 없는 응답입니다.
'
);
}
)
.
catch
(()
=>
{
// Do nothing.
}
);
}
,
...
mapActions
([
'
toggleNavDrawer
'
,
'
setLogout
'
,
]),
}
,
}
;
...
...
This diff is collapsed.
Click to expand it.
src/settings/api.js
+
1
−
1
View file @
a07f0a80
...
...
@@ -22,7 +22,7 @@ export default {
mode
:
'
cors
'
,
},
post
:
data
=>
({
body
:
JSON
.
stringify
(
data
),
body
:
data
!==
null
?
JSON
.
stringify
(
data
)
:
null
,
credentials
:
'
include
'
,
headers
:
{
Accept
:
'
application/json
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment