generated from purwadhikafullstack/finpro-nextjs-express-prisma
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: final (#34) * fix: fixx * feat: final * fix: update profile bug (#36) * fix: verify token for verify email and forgot password (#38) * fix: fin (#39) * fix: conflict (#41) * Update main.yml * Update package.json * Update axios.ts * feat: final (#34) (#35) * fix: fixx * feat: final Co-authored-by: SansanSaga <154500077+SansanSaga@users.noreply.github.com> * Merge develop to main (#37) * feat: final (#34) * fix: fixx * feat: final * fix: update profile bug (#36) --------- Co-authored-by: SansanSaga <154500077+SansanSaga@users.noreply.github.com> Co-authored-by: Laila Yunita <161436964+lailayunita@users.noreply.github.com> --------- Co-authored-by: Daniel Reinhard <119338658+danielreinhard1129@users.noreply.github.com> Co-authored-by: Laila Yunita <161436964+lailayunita@users.noreply.github.com> * fix: fixing (#42) --------- Co-authored-by: SansanSaga <154500077+SansanSaga@users.noreply.github.com> Co-authored-by: Laila Yunita <161436964+lailayunita@users.noreply.github.com> Co-authored-by: Samboga <samboga.ngusman@gmail.com>
- Loading branch information
1 parent
d2bb53c
commit c9bb67d
Showing
21 changed files
with
600 additions
and
365 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { JWT_SECRET_EMAIL, JWT_SECRET_PASSWORD } from '@/config'; | ||
import { Role } from '@prisma/client'; | ||
import { NextFunction, Request, Response } from 'express'; | ||
import { TokenExpiredError, verify } from 'jsonwebtoken'; | ||
|
||
interface PayloadToken { | ||
id: number; | ||
role: Role; | ||
} | ||
|
||
export const verifyTokenForgotPassword = ( | ||
req: Request, | ||
res: Response, | ||
next: NextFunction, | ||
) => { | ||
const token = req.headers.authorization?.split(' ')[1]; | ||
|
||
if (!token) { | ||
return res.status(401).send({ | ||
message: 'token is missing', | ||
}); | ||
} | ||
|
||
verify(token, JWT_SECRET_PASSWORD!, (err, payload) => { | ||
if (err) { | ||
if (err instanceof TokenExpiredError) { | ||
return res.status(403).send({ message: 'token expired' }); | ||
} else { | ||
return res.status(401).send({ message: 'unauthorized' }); | ||
} | ||
} | ||
|
||
res.locals.user = payload as PayloadToken; | ||
|
||
next(); | ||
}); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Skeleton } from "@/components/ui/skeleton"; | ||
import { Button } from "@/components/ui/button"; | ||
import Link from "next/link"; | ||
import { FaPlus } from "react-icons/fa"; | ||
|
||
const TableSkeletonPure = () => { | ||
return ( | ||
<div className="mx-auto max-w-7xl space-y-8 p-6 md:p-10"> | ||
<div className="flex items-center justify-between"> | ||
<h3 className="text-2xl font-semibold"> | ||
<Skeleton className="h-6 w-32" /> | ||
</h3> | ||
</div> | ||
|
||
<section className="rounded-md border-[1px] bg-white"> | ||
<Skeleton className="h-12 w-full border-b-[1px]" /> | ||
<div className="space-y-2"> | ||
{[...Array(3)].map((_, index) => ( | ||
<div key={index} className="flex items-center justify-between p-2"> | ||
<Skeleton className="h-5 w-12" /> | ||
<Skeleton className="h-5 w-32" /> | ||
<Skeleton className="h-5 w-24" /> | ||
<Skeleton className="h-5 w-24" /> | ||
<Skeleton className="h-5 w-24" /> | ||
<div className="flex gap-2"> | ||
<Skeleton className="h-8 w-12" /> | ||
<Skeleton className="h-8 w-12" /> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
</section> | ||
|
||
<div className="flex justify-center"> | ||
<Skeleton className="h-10 w-48" /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TableSkeletonPure; |
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
34 changes: 34 additions & 0 deletions
34
apps/web/src/features/dashboard/notifications/components/NotificationCard.tsx
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,34 @@ | ||
import { Badge } from "@/components/ui/badge"; | ||
import { Card } from "@/components/ui/card"; | ||
import { format } from "date-fns"; | ||
|
||
interface NotificationCardProps { | ||
title: string; | ||
message: string; | ||
timeOfOrder: Date; | ||
} | ||
|
||
const NotificationCard: React.FC<NotificationCardProps> = ({ | ||
title, | ||
message, | ||
timeOfOrder, | ||
}) => { | ||
const createdAt = format(new Date(timeOfOrder), "dd MMM yyyy, HH:mm:ss"); | ||
|
||
return ( | ||
<Card> | ||
<div className="flex flex-row items-center justify-between bg-[#e5f3f6] p-4"> | ||
<span className="font-semibold">{createdAt}</span> | ||
<Badge>Notifikasi</Badge> | ||
</div> | ||
<div className="space-y-2 p-4"> | ||
<div className="rounded-md bg-neutral-100 p-2 text-center">{title}</div> | ||
<div className="flex flex-col gap-2"> | ||
<p className="line-clamp-4">{message}</p> | ||
</div> | ||
</div> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default NotificationCard; |
Oops, something went wrong.