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