-
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.
feat(notifications): order, theme fix
- Loading branch information
Showing
7 changed files
with
130 additions
and
20 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,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
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