-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Remove console logs and enhance metadata handling by adding…
… title extraction in EntryPage, ForceDirectedGraph, and ForceFromEntry components
- Loading branch information
Showing
5 changed files
with
224 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { NextResponse } from 'next/server'; | ||
|
||
import { logger } from '@/libs/Logger'; | ||
|
||
import { GET } from '../getCBPath/route'; | ||
|
||
// import env variables | ||
|
||
export const POST = async (request: Request) => { | ||
const { page, limit, sortModel } = await request.json(); | ||
const { CLOUD_URL } = process.env; | ||
|
||
const dbRes = await GET(request); | ||
if (!dbRes) { | ||
return NextResponse.json({}, { status: 500 }); | ||
} | ||
const { DATABASE_URL, API_KEY } = await dbRes.json(); | ||
|
||
const resp = await fetch(`${CLOUD_URL}/log`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
page, | ||
limit, | ||
sortModel, | ||
dbPath: DATABASE_URL, | ||
apiKey: API_KEY, | ||
}), | ||
}); | ||
logger.info('resp:', resp); | ||
const data = await resp.json(); | ||
|
||
try { | ||
logger.info(`A new log has been created ${JSON.stringify(data)}`); | ||
|
||
return NextResponse.json({ | ||
data, | ||
}); | ||
} catch (error) { | ||
logger.error(error, 'An error occurred while creating a log'); | ||
|
||
return NextResponse.json({}, { status: 500 }); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters