UNPKG
@elastic-suite/gally-admin-shared
Version:
1-0-x (1.0.0)
2-2-x (2.2.0)
canary (2.3.0-alpha-1)
latest (2.3.0)
main (2.2.0)
2.3.0
2.3.0-alpha-1
2.2.2-alpha.0
2.2.1
2.2.0
2.1.0
2.1.0-alpha.1
2.1.0-alpha.0
2.0.1-alpha.0
2.0.0
2.0.0-alpha.0
1.3.1
1.3.0
1.3.0-alpha.1
1.3.0-alpha.0
1.2.0
1.2.0-alpha.8
1.2.0-alpha.7
1.2.0-alpha.2
1.2.0-alpha.1
1.2.0-alpha.0
1.1.0
1.1.0-alpha.1
1.1.0-alpha.0
1.0.2
1.0.1
1.0.1-alpha.0
1.0.0
0.2.0
Shared package for gally admin BO
github.com/Elastic-Suite/gally-admin
Elastic-Suite/gally-admin
@elastic-suite/gally-admin-shared
/
src
/
services
/
user.ts
12 lines
(8 loc)
•
274 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
import
jwtDecode
from
'jwt-decode'
import
{
IUser
}
from
'../types'
export
function
isValidUser
(
user?: IUser |
null
): boolean {
return
Boolean
(user &&
Date
.
now
() /
1000
< user.
exp
) }
export
function
getUser
(
token?: string
):
IUser
{
return
jwtDecode
(token)
as
IUser
}