Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sweepstake
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arjun Jhukal
sweepstake
Commits
46488729
Commit
46488729
authored
Dec 16, 2025
by
Arjun Jhukal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated the cookie for th age
parent
f8b6e951
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletions
+18
-1
index.tsx
src/components/organism/dialog/index.tsx
+18
-1
No files found.
src/components/organism/dialog/index.tsx
View file @
46488729
...
...
@@ -3,15 +3,32 @@ import { useAppSelector } from "@/hooks/hook";
import
{
Box
,
Button
,
Dialog
,
DialogContent
,
Typography
}
from
"@mui/material"
;
import
{
useEffect
,
useState
}
from
"react"
;
const
AGE_COOKIE_KEY
=
"age_verified"
;
const
ONE_DAY
=
24
*
60
*
60
;
export
default
function
AgeVerificationModal
()
{
const
user
=
useAppSelector
((
state
)
=>
state
.
auth
.
user
);
const
[
open
,
setOpen
]
=
useState
(
false
);
const
setAgeCookie
=
()
=>
{
document
.
cookie
=
`
${
AGE_COOKIE_KEY
}
=true; max-age=
${
ONE_DAY
}
; path=/; SameSite=Lax`
;
};
const
getAgeCookie
=
()
=>
{
return
document
.
cookie
.
split
(
"; "
)
.
find
((
row
)
=>
row
.
startsWith
(
`
${
AGE_COOKIE_KEY
}
=`
));
};
useEffect
(()
=>
{
setOpen
(
!
user
);
const
ageVerified
=
getAgeCookie
();
setOpen
(
!
user
&&
!
ageVerified
);
},
[
user
]);
const
handleConfirmAge
=
()
=>
{
setAgeCookie
();
setOpen
(
false
);
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment