fix: only redirect in layout only if on redirect page

This commit is contained in:
Rotimi Best
2025-09-10 17:18:01 +01:00
parent 12c0f00007
commit f60809a249
2 changed files with 3 additions and 13 deletions
@@ -112,7 +112,6 @@ export async function getProfile({
// Profile created, go to onboarding or lms
if (!error && newProfileData) {
console.log('newProfileData', newProfileData);
user.update((_user) => ({
..._user,
fetchingUser: false,
@@ -128,7 +127,6 @@ export async function getProfile({
handleLocaleChange(newProfileData[0].locale);
if (isOrgSite) {
console.log('isOrgSite', isOrgSite);
const { data, error } = await supabase
.from('organizationmember')
.insert({
@@ -137,8 +135,6 @@ export async function getProfile({
role_id: 3
})
.select();
console.log('data', data);
console.log('error', error);
if (error) {
console.error('Error adding user to organisation', error);
} else {
@@ -152,10 +148,8 @@ export async function getProfile({
}
if (params.get('redirect')) {
console.log('redirect', params.get('redirect'));
goto(params.get('redirect') || '');
} else {
console.log('redirect', '/lms');
} else if (shouldRedirectOnAuth(path)) {
goto('/lms');
}
return;
@@ -112,10 +112,6 @@
});
}
$: console.log('data', data);
$: console.log('currentOrg', $currentOrg);
$: console.log('profile', $profile);
function setCurOrg(cOrg: CurrentOrg) {
if (!cOrg) return;
currentOrg.set(cOrg);
@@ -136,7 +132,7 @@
{supabase}
isLogin={false}
{handleSubmit}
isLoading={loading}
isLoading={loading || !$profile.id}
showOnlyContent={true}
showLogo={true}
bind:formRef
@@ -151,7 +147,7 @@
label="Join Course"
type="submit"
isDisabled={disableSubmit || loading}
isLoading={loading}
isLoading={loading || !$profile.id}
/>
</div>
</AuthUI>