-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from stoqey/notifications
Notifications
- Loading branch information
Showing
18 changed files
with
532 additions
and
335 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'dotenv/config'; | ||
|
||
import type { CodegenConfig } from '@graphql-codegen/cli'; | ||
|
||
import { getBackendHost } from './src/lib/utils/api.utils'; | ||
|
||
const config: CodegenConfig = { | ||
overwrite: true, | ||
schema: `${getBackendHost()}/graphql`, | ||
// documents: ["components/**/*.graphql"], | ||
generates: { | ||
'src/components/types.generated.ts': { plugins: ['typescript'] }, | ||
'src/components/': { | ||
preset: 'near-operation-file', | ||
presetConfig: { | ||
extension: '.generated.ts', | ||
baseTypesPath: 'types.generated.ts', | ||
}, | ||
plugins: ['typescript-operations', 'typed-document-node'], | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
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,32 @@ | ||
'use server'; | ||
|
||
// import { logger } from '@/lib/Logger'; | ||
import { isEmpty } from 'lodash'; | ||
import { NextResponse } from 'next/server'; | ||
|
||
import { | ||
getNotificationNextPath, | ||
readNotifications, | ||
} from '@/lib/hooksServer/notifications'; | ||
|
||
export const GET = async ( | ||
req: Request, | ||
{ params }: { params: { slug: string } }, | ||
) => { | ||
try { | ||
const id = params.slug; | ||
const notifications = await readNotifications({ id }); | ||
if (!notifications || isEmpty(notifications)) { | ||
throw new Error('Notifications not found'); | ||
} | ||
const notification = notifications[0]; | ||
if (!notification) { | ||
throw new Error('Notification not found'); | ||
} | ||
const nextPath = getNotificationNextPath(notification); | ||
return NextResponse.redirect(new URL(nextPath, req.url)); | ||
} catch (error) { | ||
console.log('An error occurred while fetching notifications', error); | ||
return NextResponse.redirect(new URL('/html/notifications', req.url)); | ||
} | ||
}; |
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,29 @@ | ||
import React from 'react'; | ||
|
||
import { NotificationsContainerHtml } from '@/containers/Notification/Notification.html'; | ||
import { fetchNotifications } from '@/lib/hooksServer/notifications'; | ||
|
||
const NotificationPage = async () => { | ||
// const cookieStore = cookies(); | ||
// let vendor; | ||
// const user = await getMe(); | ||
// if (user) { | ||
// vendor = await getVendor(); | ||
// } | ||
|
||
const notifications = await fetchNotifications({ before: new Date() }); | ||
|
||
// console.log('notifications', notifications); | ||
// const message = cookieStore.get("message")?.value; | ||
// const success = cookieStore.get("success")?.value === "true"; | ||
|
||
return ( | ||
<NotificationsContainerHtml | ||
notifications={notifications?.items || []} | ||
// message={message} | ||
// success={success} | ||
/> | ||
); | ||
}; | ||
|
||
export default NotificationPage; |
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
Oops, something went wrong.