onboarding completed

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-16 11:41:15 +02:00
committed by Carl-Gerhard Lindesvärd
parent 97627583ec
commit 7d22d2ddad
79 changed files with 2542 additions and 805 deletions

View File

@@ -0,0 +1,44 @@
import { cookies } from 'next/headers';
import { escape } from 'sqlstring';
import {
getCurrentOrganizations,
getEvents,
getProjectWithClients,
} from '@openpanel/db';
import OnboardingVerify from './onboarding-verify';
type Props = {
params: {
projectId: string;
};
};
const Verify = async ({ params: { projectId } }: Props) => {
const orgs = await getCurrentOrganizations();
const organizationSlug = orgs[0]?.slug;
if (!organizationSlug) {
throw new Error('No organization found');
}
const [project, events] = await Promise.all([
await getProjectWithClients(projectId),
getEvents(
`SELECT * FROM events WHERE project_id = ${escape(projectId)} LIMIT 100`
),
]);
const clientSecret = cookies().get('onboarding_client_secret')?.value ?? null;
if (!project) {
return <div>Hmm, something fishy is going on. Please reload the page.</div>;
}
// set visible client secret from cookie
if (clientSecret && project.clients[0]) {
project.clients[0].secret = clientSecret;
}
return <OnboardingVerify project={project} events={events} />;
};
export default Verify;