-
-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33b28ad
commit 639c504
Showing
6 changed files
with
55 additions
and
13 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Knock } from '@knocklabs/node'; | ||
|
||
const knockApiKey = process.env.KNOCK_API_KEY; | ||
|
||
if (!knockApiKey) { | ||
throw new Error('KNOCK_API_KEY is not set'); | ||
} | ||
|
||
export const knock = new Knock(knockApiKey); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { KnockFeedProvider, KnockProvider } from '@knocklabs/react'; | ||
import type { ReactNode } from 'react'; | ||
|
||
const knockApiKey = process.env.KNOCK_API_KEY; | ||
const knockFeedChannelId = process.env.KNOCK_FEED_CHANNEL_ID; | ||
|
||
if (!knockApiKey) { | ||
throw new Error('KNOCK_API_KEY is not set'); | ||
} | ||
|
||
if (!knockFeedChannelId) { | ||
throw new Error('KNOCK_FEED_CHANNEL_ID is not set'); | ||
} | ||
|
||
export const NotificationsProvider = ({ | ||
children, | ||
userId, | ||
}: { children: ReactNode; userId: string }) => ( | ||
<KnockProvider apiKey={knockApiKey} userId={userId}> | ||
<KnockFeedProvider feedId={knockFeedChannelId}> | ||
{children} | ||
</KnockFeedProvider> | ||
</KnockProvider> | ||
); |