We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1019a6e commit 3c93d8eCopy full SHA for 3c93d8e
src/controllers/NotionController.ts
@@ -37,6 +37,18 @@ class NotionController {
37
38
async search(req: Request, res: Response) {
39
try {
40
+ // Check for Notion connection first
41
+ const linkInfo = await this.service.getNotionLinkInfo(res.locals.owner);
42
+ if (!linkInfo.isConnected) {
43
+ const renewalLink = this.service.getNotionAuthorizationLink(
44
+ this.service.getClientId()
45
+ );
46
+ return res.status(401).json({
47
+ message: `Notion is not connected. Please connect your account <a href='${renewalLink}'>here</a>.`,
48
+ });
49
+ }
50
+
51
+ // Proceed with search if connected
52
const query = req.body.query.toString() || '';
53
const result = await this.service.search(query, getOwner(res));
54
res.json(result);
0 commit comments