Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Koen Martens
sonocrm
Commits
97f8d2f1
Commit
97f8d2f1
authored
Feb 16, 2022
by
Koen Martens
Browse files
Frontend: ping server periodically to refresh jwt
parent
671d8a4b
Changes
3
Hide whitespace changes
Inline
Side-by-side
frontend/src/App.vue
View file @
97f8d2f1
...
...
@@ -35,8 +35,8 @@ export default {
methods
:
{
logoff
()
{
this
.
$store
.
commit
(
'
jwt
'
,
null
);
}
}
}
,
}
,
}
</
script
>
...
...
frontend/src/components/Logon.vue
View file @
97f8d2f1
...
...
@@ -25,6 +25,7 @@ export default {
username
:
''
,
password
:
''
,
error
:
''
,
token_expiry
:
0
,
}
},
watch
:
{
...
...
@@ -46,6 +47,8 @@ export default {
})
.
then
(
response
=>
{
this
.
$store
.
commit
(
'
identity
'
,
response
.
data
.
identity
);
this
.
$data
.
token_expiry
=
response
.
data
.
token_expiry
;
this
.
keep_auth_alive
();
})
.
catch
(
error
=>
{
if
(
error
.
response
&&
error
.
response
.
status
==
401
)
{
...
...
@@ -57,6 +60,20 @@ export default {
},
enter_username
()
{
this
.
$refs
.
password
.
focus
();
},
keep_auth_alive
()
{
setTimeout
(()
=>
{
if
(
this
.
$store
.
getters
.
authenticated
)
{
axios
.
get
(
this
.
$store
.
getters
.
api_url
([
'
ping
'
]),
{
headers
:
this
.
$store
.
getters
.
auth_headers
(),
withCredentials
:
true
}).
then
(()
=>
{
this
.
keep_auth_alive
();
}).
catch
(
error
=>
{
console
.
log
(
error
);
});
}
},
(
this
.
$data
.
token_expiry
/
2
)
*
1000
);
}
},
computed
:
{
...
...
frontend/src/components/contacts/Roles.vue
View file @
97f8d2f1
...
...
@@ -130,8 +130,6 @@
this
.
$refs
.
roles_table
.
clearSelected
();
},
'
role_changed
'
:
function
(
item
)
{
console
.
log
(
'
role changed
'
);
console
.
log
(
item
);
let
verb
=
axios
.
put
;
let
endpoint
=
[
'
roles
'
,
item
.
id
];
if
(
item
.
id
==
null
)
{
...
...
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