courrier msft oauth
This commit is contained in:
parent
f60e8520e7
commit
dde98bb598
@ -4,35 +4,53 @@ import { authOptions } from '@/app/api/auth/[...nextauth]/route';
|
|||||||
import { ResponsiveIframe } from '@/app/components/responsive-iframe';
|
import { ResponsiveIframe } from '@/app/components/responsive-iframe';
|
||||||
import { redirect } from 'next/navigation';
|
import { redirect } from 'next/navigation';
|
||||||
|
|
||||||
const menuItems = {
|
// Use environment variables for real service URLs
|
||||||
|
const menuItems: Record<string, string> = {
|
||||||
|
parole: process.env.NEXT_PUBLIC_IFRAME_PAROLE_URL || '',
|
||||||
|
alma: process.env.NEXT_PUBLIC_IFRAME_AI_ASSISTANT_URL || '',
|
||||||
|
crm: process.env.NEXT_PUBLIC_IFRAME_MEDIATIONS_URL || '',
|
||||||
|
vision: process.env.NEXT_PUBLIC_IFRAME_CONFERENCE_URL || '',
|
||||||
|
showcase: process.env.NEXT_PUBLIC_IFRAME_SHOWCASE_URL || '',
|
||||||
|
agilite: process.env.NEXT_PUBLIC_IFRAME_AGILITY_URL || '',
|
||||||
|
dossiers: process.env.NEXT_PUBLIC_IFRAME_DRIVE_URL || '',
|
||||||
|
'the-message': process.env.NEXT_PUBLIC_IFRAME_THEMESSAGE_URL || '',
|
||||||
|
qg: process.env.NEXT_PUBLIC_IFRAME_MISSIONVIEW_URL || '',
|
||||||
|
// Keep any existing custom ones
|
||||||
board: "https://example.com/board",
|
board: "https://example.com/board",
|
||||||
chapter: "https://example.com/chapter",
|
chapter: "https://example.com/chapter",
|
||||||
flow: "https://example.com/flow",
|
flow: "https://example.com/flow",
|
||||||
design: "https://example.com/design",
|
design: "https://example.com/design",
|
||||||
gitlab: "https://gitlab.com",
|
gitlab: "https://gitlab.com",
|
||||||
crm: "https://example.com/crm",
|
|
||||||
missions: "https://example.com/missions"
|
missions: "https://example.com/missions"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix the params type issue by using generateMetadata or a different approach
|
// Using a different approach for metadata that doesn't directly access params.section
|
||||||
export async function generateMetadata({ params }: { params: { section: string } }) {
|
export async function generateMetadata({ params }: { params: { section: string } }) {
|
||||||
return {
|
// Safely handle params
|
||||||
title: `${params.section.charAt(0).toUpperCase() + params.section.slice(1)}`,
|
const paramsObj = await Promise.resolve(params);
|
||||||
}
|
const sectionName = paramsObj?.section || '';
|
||||||
|
|
||||||
|
// Capitalize first letter
|
||||||
|
const title = sectionName ?
|
||||||
|
sectionName.charAt(0).toUpperCase() + sectionName.slice(1) :
|
||||||
|
'Section';
|
||||||
|
|
||||||
|
return { title };
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function SectionPage({ params }: { params: { section: string } }) {
|
export default async function SectionPage(props: { params: { section: string } }) {
|
||||||
// Ensure authentication first
|
// Ensure authentication first
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
if (!session) {
|
if (!session) {
|
||||||
redirect("/signin");
|
redirect("/signin");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get section from params
|
// Safely extract section using await Promise.resolve
|
||||||
const section = params.section;
|
const params = await Promise.resolve(props.params);
|
||||||
|
const section = params?.section || '';
|
||||||
|
|
||||||
// Check if section exists in our menu items
|
// Check if section exists in our menu items
|
||||||
if (!(section in menuItems)) {
|
if (!section || !(section in menuItems)) {
|
||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user