Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Khalid Ali
bookshare-frontend
Commits
543d64a1
Commit
543d64a1
authored
Mar 10, 2019
by
Khalid Ali
Browse files
Get CSRF token from home page
parent
2ad4af2d
Pipeline
#4051
failed with stages
in 2 minutes and 46 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/router.ts
View file @
543d64a1
...
...
@@ -35,13 +35,5 @@ export default new Router({
title
:
'
SRCT Bookshare - Create Listing
'
,
},
},
{
path
:
'
/login
'
,
name
:
'
login
'
,
component
:
()
=>
import
(
'
./views/Login.vue
'
),
meta
:
{
title
:
'
SRCT Bookshare - Login
'
,
},
}
],
});
src/views/CreateListing.vue
View file @
543d64a1
...
...
@@ -161,13 +161,13 @@ export default class CreateListing extends Vue {
// }
mounted
()
{
API
.
get
(
"
/bs
"
).
then
(
function
(
response
)
{
console
.
log
(
response
.
headers
);
}).
catch
(
function
(
error
)
{
const
token
=
error
.
response
.
headers
[
"
x-csrf-token
"
];
if
(
error
.
response
.
headers
[
"
x-csrf-token
"
]
!=
null
)
{
API
.
get
(
"
/
"
).
then
(
function
(
response
)
{
const
token
=
response
.
headers
[
"
x-csrf-token
"
];
if
(
response
.
headers
[
"
x-csrf-token
"
]
!=
null
)
{
localStorage
.
setItem
(
"
csrf_token
"
,
token
);
}
}).
catch
(
function
(
error
)
{
console
.
log
(
error
.
response
);
})
}
...
...
Write
Preview
Markdown
is supported
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