Browse Source

Add return URL to login form

gh-pages
Andrew Kingston 5 years ago
parent
commit
e7e2a81d98
  1. 10
      packages/builder/src/components/login/LoginForm.svelte

10
packages/builder/src/components/login/LoginForm.svelte

@ -1,5 +1,5 @@
<script> <script>
import { goto } from "@roxi/routify" import { goto, params } from "@roxi/routify"
import { import {
notifications, notifications,
Input, Input,
@ -22,8 +22,12 @@
username, username,
password, password,
}) })
notifications.success("Logged in successfully") if ($params["?returnUrl"]) {
$goto("../portal") window.location = decodeURIComponent($params["?returnUrl"])
} else {
notifications.success("Logged in successfully")
$goto("../portal")
}
} catch (err) { } catch (err) {
console.error(err) console.error(err)
notifications.error("Invalid credentials") notifications.error("Invalid credentials")

Loading…
Cancel
Save