-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
26c4b2f
commit 731fd00
Showing
5 changed files
with
35 additions
and
27 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 was deleted.
Oops, something went wrong.
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,30 @@ | ||
'use client'; | ||
|
||
import { KnockFeedProvider, KnockProvider } from '@knocklabs/react'; | ||
import type { ReactNode } from 'react'; | ||
import { keys } from '../keys'; | ||
|
||
const knockApiKey = keys().KNOCK_SECRET_API_KEY; | ||
const knockFeedChannelId = keys().KNOCK_FEED_CHANNEL_ID; | ||
|
||
type NotificationsProviderProps = { | ||
children: ReactNode; | ||
userId: string; | ||
}; | ||
|
||
export const NotificationsProvider = ({ | ||
children, | ||
userId, | ||
}: NotificationsProviderProps) => { | ||
if (!knockApiKey || !knockFeedChannelId) { | ||
return children; | ||
} | ||
|
||
return ( | ||
<KnockProvider apiKey={knockApiKey} userId={userId}> | ||
<KnockFeedProvider feedId={knockFeedChannelId}> | ||
{children} | ||
</KnockFeedProvider> | ||
</KnockProvider> | ||
); | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.