fix: onboarding infinite spinner
This commit is contained in:
+4
-1
@@ -24,4 +24,7 @@ VITE_SENTRY_PROJECT_NAME=
|
||||
OPENAI_API_KEY=
|
||||
|
||||
# Sever URL - Optional if you want to use video upload and pdf downloads
|
||||
PUBLIC_SERVER_URL=
|
||||
PUBLIC_SERVER_URL=
|
||||
|
||||
# For getting metadata for signup users.
|
||||
PUBLIC_IP_REGISTRY_KEY=
|
||||
@@ -20,6 +20,7 @@ export type PollType = {
|
||||
avatarUrl: string;
|
||||
};
|
||||
status: string;
|
||||
isPublic: boolean;
|
||||
expiration: string | Date;
|
||||
options: PollOptionType[];
|
||||
};
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
});
|
||||
if (!student || !teacherFullname || !teacherEmail) return;
|
||||
|
||||
const baseUrl = `https://app.classroomio.com/courses/${$course.id}`;
|
||||
const baseUrl = `${window.location.origin}/courses/${$course.id}`;
|
||||
const exerciseLink = `${baseUrl}/lessons/${$lesson.id}/exercises/${exerciseId}`;
|
||||
const submissionLink = `${baseUrl}/submissions`;
|
||||
const content = `
|
||||
|
||||
@@ -17,7 +17,6 @@ export const getSupabase = (config?: ConfigType) => {
|
||||
anonKey: PUBLIC_SUPABASE_ANON_KEY || ''
|
||||
}
|
||||
};
|
||||
console.log('supabase config', config);
|
||||
|
||||
supabase = createClient(config.supabaseConfig.url, config.supabaseConfig.anonKey);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</p>
|
||||
<a
|
||||
class="bg-primary-700 hover:bg-primary-900 hover:no-underline transition-all py-3 px-9 rounded-xl text-white mt-3"
|
||||
href="mailto:[email protected]">Contact Us</a
|
||||
href="/">Go Home</a
|
||||
>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
data: { session }
|
||||
} = await supabase.auth.getSession();
|
||||
const { user: authUser } = session || {};
|
||||
console.log('Get user profile', authUser);
|
||||
console.log('Get user', authUser);
|
||||
|
||||
if (!authUser) {
|
||||
goto('/login?redirect=/' + path);
|
||||
@@ -89,6 +89,8 @@
|
||||
error,
|
||||
status
|
||||
} = await supabase.from('profile').select(`*`).eq('id', authUser?.id).single();
|
||||
console.log('Get user', authUser);
|
||||
console.log('Get profile', profileData);
|
||||
|
||||
if (error && !profileData && status === 406 && authUser) {
|
||||
// User wasn't found, create profile
|
||||
@@ -182,6 +184,10 @@
|
||||
setTheme(orgRes.currentOrg.theme);
|
||||
}
|
||||
}
|
||||
|
||||
if (!profileData) {
|
||||
goto('/login?redirect=/' + path);
|
||||
}
|
||||
}
|
||||
|
||||
function handleResize() {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
try {
|
||||
loading = true;
|
||||
const { data, error } = await supabase.auth.resetPasswordForEmail(fields.email, {
|
||||
redirectTo: 'https://app.classroomio.com/reset'
|
||||
redirectTo: `${window.location.origin}/reset`
|
||||
});
|
||||
console.log('data', data);
|
||||
if (error) throw error;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { PUBLIC_IP_REGISTRY_KEY } from '$env/static/public';
|
||||
import { goto } from '$app/navigation';
|
||||
import TextField from '$lib/components/Form/TextField.svelte';
|
||||
import UserProfileIcon from '$lib/components/Icons/UserProfileIcon.svelte';
|
||||
@@ -81,26 +82,20 @@
|
||||
];
|
||||
|
||||
async function setMetaData() {
|
||||
const response = await fetch('https://api.ipregistry.co/?key=tryout');
|
||||
if (!PUBLIC_IP_REGISTRY_KEY) return;
|
||||
|
||||
const response = await fetch(`https://api.ipregistry.co/?key=${PUBLIC_IP_REGISTRY_KEY}`);
|
||||
const payload = await response.json();
|
||||
fields.metadata = payload;
|
||||
}
|
||||
|
||||
function setOrgSiteName(orgName: string | undefined, isTouched: boolean) {
|
||||
if (!orgName || isTouched) return;
|
||||
let inputElement = event?.target as HTMLInputElement;
|
||||
let value = inputElement.name;
|
||||
|
||||
if (value == 'orgname') {
|
||||
fields.siteName = orgName
|
||||
?.toLowerCase()
|
||||
?.replace(/\s+/g, '-')
|
||||
?.replace(/[^a-zA-Z0-9-]/g, '');
|
||||
} else {
|
||||
if (value == 'sitename') {
|
||||
fields.siteName = inputElement.value;
|
||||
}
|
||||
}
|
||||
fields.siteName = orgName
|
||||
?.toLowerCase()
|
||||
?.replace(/\s+/g, '-')
|
||||
?.replace(/[^a-zA-Z0-9-]/g, '');
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
@@ -110,7 +105,7 @@
|
||||
errors = onboardingValidation(fields, step);
|
||||
console.log('errors', errors);
|
||||
|
||||
if (Object.keys(errors).length) {
|
||||
if (Object.keys(errors).length || !$profile.id) {
|
||||
loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user