Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
scc-net
netvs
netvs-core
Commits
8a37101f
Commit
8a37101f
authored
Sep 27, 2019
by
janis.streib
🦉
Browse files
ADD: new login/logout handling in frontend
parent
ab159534
Pipeline
#55127
passed with stages
in 2 minutes and 56 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/App.vue
View file @
8a37101f
...
...
@@ -43,7 +43,7 @@
<font-awesome-icon
:icon=
"['far', 'user']"
></font-awesome-icon>
<span
v-if=
"$store.state.user"
>
{{
$store
.
state
.
user
.
login_name
}}
</span>
</
template
>
<b-dropdown-item
v-if=
"$store.state.user"
to
=
"
/
logout"
>
Abmelden
</b-dropdown-item>
<b-dropdown-item
v-if=
"$store.state.user"
@
click
=
"logout
()
"
>
Abmelden
</b-dropdown-item>
</b-nav-item-dropdown>
<b-nav-item
v-if=
"!$store.state.user"
>
<font-awesome-icon
:icon=
"['far', 'user']"
></font-awesome-icon>
...
...
@@ -95,6 +95,8 @@
</
style
>
<
script
>
import
LoginService
from
'
@/api-services/login.service
'
export
default
{
data
()
{
return
{
...
...
@@ -129,7 +131,11 @@
}
}
return
res
},
logout
()
{
LoginService
.
logout
(
this
.
$store
.
state
.
token
.
pk
)
this
.
$store
.
commit
(
'
logout
'
)
this
.
$router
.
push
(
'
/login
'
)
}
}
}
...
...
frontend/src/api-services/login.service.js
View file @
8a37101f
import
Axios
from
'
axios
'
;
const
RESOURCE_NAME
=
'
/api/login
'
;
const
LOGIN_RESOURCE
=
'
/api/login
'
;
const
LOGOUT_RESOURCE
=
'
/api/logout
'
;
export
default
{
login
(
username
,
password
)
{
return
Axios
.
post
(
RESOURCE_NAME
,
{
'
username
'
:
username
,
'
password
'
:
password
})
return
Axios
.
post
(
LOGIN_RESOURCE
,
{
'
username
'
:
username
,
'
password
'
:
password
})
},
logout
(
token_pk
)
{
return
Axios
.
post
(
LOGOUT_RESOURCE
,
{
'
token_pk
'
:
token_pk
})
}
};
Write
Preview
Supports
Markdown
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