Use core CookieUtils in client library
This commit is contained in:
parent
604788a244
commit
7b32543537
|
@ -3,6 +3,7 @@
|
||||||
import { setContext, onMount } from "svelte"
|
import { setContext, onMount } from "svelte"
|
||||||
import { Layout, Heading, Body } from "@budibase/bbui"
|
import { Layout, Heading, Body } from "@budibase/bbui"
|
||||||
import ErrorSVG from "@budibase/frontend-core/assets/error.svg"
|
import ErrorSVG from "@budibase/frontend-core/assets/error.svg"
|
||||||
|
import { Constants, CookieUtils } from "@budibase/frontend-core"
|
||||||
import Component from "./Component.svelte"
|
import Component from "./Component.svelte"
|
||||||
import SDK from "sdk"
|
import SDK from "sdk"
|
||||||
import {
|
import {
|
||||||
|
@ -63,9 +64,8 @@
|
||||||
} else {
|
} else {
|
||||||
// The user is not logged in, redirect them to login
|
// The user is not logged in, redirect them to login
|
||||||
const returnUrl = `${window.location.pathname}${window.location.hash}`
|
const returnUrl = `${window.location.pathname}${window.location.hash}`
|
||||||
// TODO: reuse `Cookies` from builder when frontend-core is added
|
CookieUtils.setCookie(Constants.Cookies.ReturnUrl, returnUrl)
|
||||||
window.document.cookie = `budibase:returnurl=${returnUrl}; Path=/`
|
window.location = "/builder/auth/login"
|
||||||
window.location = `/builder/auth/login`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue