Enhance adventure management: add error handling for category fetch, implement unique email constraint in user model, and update adventure save logic to ensure category assignment
This commit is contained in:
@@ -39,6 +39,8 @@ export const load = (async (event) => {
|
||||
);
|
||||
|
||||
if (!initialFetch.ok) {
|
||||
let error_message = await initialFetch.json();
|
||||
console.error(error_message);
|
||||
console.error('Failed to fetch visited adventures');
|
||||
return redirect(302, '/login');
|
||||
} else {
|
||||
|
||||
@@ -337,7 +337,8 @@
|
||||
<Popup openOn="click" offset={[0, -10]}>
|
||||
<div class="text-lg text-black font-bold">{adventure.name}</div>
|
||||
<p class="font-semibold text-black text-md">
|
||||
{adventure.type.charAt(0).toUpperCase() + adventure.type.slice(1)}
|
||||
{adventure.category.display_name}
|
||||
{adventure.category.icon}
|
||||
</p>
|
||||
{#if adventure.visits.length > 0}
|
||||
<p class="text-black text-sm">
|
||||
|
||||
@@ -39,14 +39,6 @@ export const actions: Actions = {
|
||||
const serverEndpoint = PUBLIC_SERVER_URL || 'http://localhost:8000';
|
||||
const csrfTokenFetch = await event.fetch(`${serverEndpoint}/csrf/`);
|
||||
|
||||
// console log each form data
|
||||
console.log('username: ', username);
|
||||
console.log('password1: ', password1);
|
||||
console.log('password2: ', password2);
|
||||
console.log('email: ', email);
|
||||
console.log('first_name: ', first_name);
|
||||
console.log('last_name: ', last_name);
|
||||
|
||||
if (!csrfTokenFetch.ok) {
|
||||
event.locals.user = null;
|
||||
return fail(500, { message: 'Failed to fetch CSRF token' });
|
||||
|
||||
Reference in New Issue
Block a user