chore: update posthug and change all 301 to 307

This commit is contained in:
Rotimi Best
2023-12-14 22:41:16 +03:00
parent 5f2037101b
commit 845b87b21f
12 changed files with 24 additions and 40 deletions
@@ -64,7 +64,7 @@ export async function fetchCourse(courseId?: Course['id'], slug?: Course['slug']
if (!data || error) {
console.log(`data`, data);
console.log(`fetchCourse => error`, error);
// return this.redirect(301, '/courses');
// return this.redirect(307, '/courses');
return { data, error };
}
+2 -11
View File
@@ -31,15 +31,6 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
const matches = url.host.match(/([a-z 0-9 -]+).*classroomio[.]com/);
const subdomain = matches?.[1] ?? '';
if (subdomain === 'app' && url.search && url.search?.includes('forwardTo')) {
const params = new URLSearchParams(url.search);
const forwardToURL = params.get('forwardTo');
if (forwardToURL) {
throw redirect(307, forwardToURL);
}
}
if (!blockedSubdomain.includes(subdomain)) {
const answer = Array.isArray(matches) ? !!subdomain && subdomain !== 'www' : false;
@@ -48,12 +39,12 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
response.org = (await getCurrentOrg(response.orgSiteName, true)) || null;
if (!response.org && !dev) {
throw redirect(301, 'https://app.classroomio.com/404?type=org');
throw redirect(307, 'https://app.classroomio.com/404?type=org');
}
} else if (subdomain === 'play' || debugPlay === 'true') {
response.skipAuth = true;
} else if (subdomain !== 'app' && !dev) {
throw redirect(301, 'https://app.classroomio.com');
throw redirect(307, 'https://app.classroomio.com');
}
return response;
@@ -26,6 +26,6 @@ export const load = async ({ params = { hash: '' } }) => {
};
} catch (error) {
console.error('Error decoding course invite params.hash', error);
throw redirect(301, '/404');
throw redirect(307, '/404');
}
};
@@ -29,6 +29,6 @@ export const load = async ({ params = { hash: '' } }) => {
};
} catch (error) {
console.error('Error decoding invite params.hash', error);
throw redirect(301, '/404');
throw redirect(307, '/404');
}
};