File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,21 @@ import { redirect } from "next/navigation";
77import { NextRequest , NextResponse } from "next/server" ;
88
99export async function GET ( req : NextRequest ) {
10+ // If api key is provided, return the project as it's used by the Python SDK.
11+ const apiKey = req . headers . get ( "x-api-key" ) ;
12+ if ( apiKey ) {
13+ const response = await authApiKey ( apiKey , false ) ;
14+ if ( response . status !== 200 ) {
15+ return response ;
16+ }
17+
18+ const data = await response . json ( ) ;
19+ return NextResponse . json ( {
20+ project : data . data . project ,
21+ } ) ;
22+ }
23+
24+ // If no api key is provided, return the project as it's used by the web app.
1025 const session = await getServerSession ( authOptions ) ;
1126 if ( ! session || ! session . user ) {
1227 redirect ( "/login" ) ;
You can’t perform that action at this time.
0 commit comments