Bug fix for loading pages with params! I think this has been a root cause of some of the issues for a while now.

This commit is contained in:
Scott Idem
2024-07-18 09:21:29 -04:00
parent 43488b8f76
commit 070e714aff
3 changed files with 150 additions and 159 deletions

View File

@@ -3,7 +3,7 @@ console.log(`ae_p_person [slug] +page.ts: start`);
import { core_func } from '$lib/ae_core_functions';
export async function load({ parent }) { // route
export async function load({ params, parent }) { // route
let log_lvl = 0;
// console.log(`ae_events_pres_mgmt_event +page.ts data.params:`, params);
// console.log(`ae_events_pres_mgmt_event +page.ts data.route:`, route);
@@ -16,11 +16,12 @@ export async function load({ parent }) { // route
let ae_acct = data[account_id];
console.log(`ae_acct = `, ae_acct);
let person_id = await data.params.person_id;
// let person_id_test = data.params.person.slug;
let person_id = params.person_id;
let person_id_test = data.params.person_id;
console.log(`person_id = `, person_id);
// console.log(`person_id_test = `, person_id_test);
if (!person_id) {
console.log(`ae_p_person [slug] +page.ts: The person_id was not found in the data.params.slug!!!`);
console.log(`ae_p_person [slug] +page.ts: The person_id was not found in the params.slug!!!`);
// return false;
// return data;
return {status: 404, error: {message: 'Person not found.'}};

View File

@@ -3,7 +3,7 @@ console.log(`ae_events_pres_mgmt_event [slug] +page.ts start`);
import { events_func } from '$lib/ae_events_functions';
export async function load({ parent }) { // route
export async function load({ params, parent }) { // route
// console.log(`ae_events_pres_mgmt_event +page.ts data.params:`, params);
// console.log(`ae_events_pres_mgmt_event +page.ts data.route:`, route);
// console.log(`ae_events_pres_mgmt_event +page.ts data.url:`, url);
@@ -24,9 +24,9 @@ export async function load({ parent }) { // route
// let param_slug_event_id = data.params.slug;
let event_id = data.params.slug;
let event_id = params.slug;
if (!event_id) {
console.log(`events_pres_mgmt_event [slug] +layout.ts: The event_id was not found in the data.params.slug!!!`);
console.log(`events_pres_mgmt_event [slug] +layout.ts: The event_id was not found in the params.slug!!!`);
return false;
}