Browse Source

Rename return URL to redirect URL in log out action

pull/4434/head
Andrew Kingston 5 years ago
parent
commit
8be7018543
  1. 6
      packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/LogOut.svelte
  2. 12
      packages/client/src/utils/buttonActions.js

6
packages/builder/src/components/design/PropertiesPanel/PropertyControls/ButtonActionEditor/actions/LogOut.svelte

@ -13,11 +13,11 @@
If you don't enter a value, you'll be redirected to the login screen.
</Body>
<div class="content">
<Label small>Return URL</Label>
<Label small>Redirect URL</Label>
<DrawerBindableInput
title="Return URL"
value={parameters.returnUrl}
on:change={value => (parameters.returnUrl = value.detail)}
value={parameters.redirectUrl}
on:change={value => (parameters.redirectUrl = value.detail)}
{bindings}
/>
</div>

12
packages/client/src/utils/buttonActions.js

@ -114,13 +114,15 @@ const refreshDataProviderHandler = async (action, context) => {
const logoutHandler = async action => {
await authStore.actions.logOut()
let returnUrl = "/builder/auth/login"
let redirectUrl = "/builder/auth/login"
let internal = false
if (action.parameters.returnUrl) {
internal = action.parameters.returnUrl?.startsWith("/")
returnUrl = routeStore.actions.createFullURL(action.parameters.returnUrl)
if (action.parameters.redirectUrl) {
internal = action.parameters.redirectUrl?.startsWith("/")
redirectUrl = routeStore.actions.createFullURL(
action.parameters.redirectUrl
)
}
window.location.href = returnUrl
window.location.href = redirectUrl
if (internal) {
window.location.reload()
}

Loading…
Cancel
Save