feat: enhance AuthUI with redirectPathname prop for improved navigation
This commit is contained in:
@@ -16,6 +16,9 @@
|
|||||||
export let showLogo = false;
|
export let showLogo = false;
|
||||||
export let formRef;
|
export let formRef;
|
||||||
export let hideGoogleAuth = false;
|
export let hideGoogleAuth = false;
|
||||||
|
export let redirectPathname = '';
|
||||||
|
|
||||||
|
$: console.log('redirectPathname', redirectPathname);
|
||||||
|
|
||||||
async function signInWithGoogle() {
|
async function signInWithGoogle() {
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
@@ -27,7 +30,8 @@
|
|||||||
// const redirectTo = `https://app.classroomio.com?forwardTo=${
|
// const redirectTo = `https://app.classroomio.com?forwardTo=${
|
||||||
// window.location.origin + params.get('redirect')
|
// window.location.origin + params.get('redirect')
|
||||||
// }`;
|
// }`;
|
||||||
const redirectTo = `${window.location.origin + params.get('redirect')}`;
|
const pathname = redirectPathname || params.get('redirect');
|
||||||
|
const redirectTo = `${window.location.origin + pathname}`;
|
||||||
|
|
||||||
console.log({ redirectTo });
|
console.log({ redirectTo });
|
||||||
|
|
||||||
|
|||||||
@@ -135,13 +135,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const redirectTo = $page.url.pathname;
|
|
||||||
|
|
||||||
const url = new URL($page.url.pathname);
|
|
||||||
url.searchParams.set('redirect', redirectTo);
|
|
||||||
console.log('url', url.toString());
|
|
||||||
goto(url.toString());
|
|
||||||
|
|
||||||
setTheme(data.invite.currentOrg?.theme || '');
|
setTheme(data.invite.currentOrg?.theme || '');
|
||||||
|
|
||||||
setCurOrg(data.invite.currentOrg as CurrentOrg);
|
setCurOrg(data.invite.currentOrg as CurrentOrg);
|
||||||
@@ -167,7 +160,15 @@
|
|||||||
<title>Join ClassroomIO</title>
|
<title>Join ClassroomIO</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<AuthUI {supabase} isLogin={false} {handleSubmit} isLoading={loading} showLogo={true} bind:formRef>
|
<AuthUI
|
||||||
|
{supabase}
|
||||||
|
redirectPathname={$page.url.pathname}
|
||||||
|
isLogin={false}
|
||||||
|
{handleSubmit}
|
||||||
|
isLoading={loading}
|
||||||
|
showLogo={true}
|
||||||
|
bind:formRef
|
||||||
|
>
|
||||||
<div class="mt-4 w-full">
|
<div class="mt-4 w-full">
|
||||||
<p class="mb-6 text-lg font-semibold dark:text-white">
|
<p class="mb-6 text-lg font-semibold dark:text-white">
|
||||||
{#if data.invite.profile}
|
{#if data.invite.profile}
|
||||||
|
|||||||
Reference in New Issue
Block a user