Skip to content

Commit

Permalink
fix: If the redirection is caused by API call to some action just red…
Browse files Browse the repository at this point in the history
…irect to resource
  • Loading branch information
JonaszJestem committed Jun 23, 2020
1 parent e2193cc commit 9fb8b97
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ const buildAuthenticatedRouter = (
} else if (req.session.adminUser) {
next()
} else {
req.session.redirectTo = req.originalUrl
// If the redirection is caused by API call to some action just redirect to resource
const [redirectTo] = req.originalUrl.split('/actions')
req.session.redirectTo = redirectTo
req.session.save((err) => {
if (err) {
next(err)
Expand Down

0 comments on commit 9fb8b97

Please sign in to comment.