Store access token with cookies
This commit is contained in:
parent
4f715d9d8c
commit
2b78605ac9
1 changed files with 8 additions and 2 deletions
|
|
@ -89,9 +89,15 @@ const LoginModal = (props: Props) => {
|
||||||
if (formValid) {
|
if (formValid) {
|
||||||
api.login(body)
|
api.login(body)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response)
|
|
||||||
const cookies = props.cookies
|
const cookies = props.cookies
|
||||||
cookies.set('user', response.data.user, { path: '/'})
|
|
||||||
|
const cookieObj = {
|
||||||
|
user_id: response.data.user.id,
|
||||||
|
username: response.data.user.username,
|
||||||
|
access_token: response.data.access_token
|
||||||
|
}
|
||||||
|
|
||||||
|
cookies.set('user', cookieObj, { path: '/'})
|
||||||
props.close()
|
props.close()
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue