feat: Add local storage functionality to track acceptance of terms of service
This commit is contained in:
parent
b283d39d81
commit
3bc2568052
@ -8,8 +8,10 @@ import {
|
|||||||
} from "@/components/ui/dialog";
|
} from "@/components/ui/dialog";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
|
const termAcceptedCacheKey = 'term_of_service_accepted';
|
||||||
|
|
||||||
function TermsOfServiceDialog() {
|
function TermsOfServiceDialog() {
|
||||||
const [isOpen, setIsOpen] = useState(true);
|
const [isOpen, setIsOpen] = useState(() => !localStorage.getItem(termAcceptedCacheKey));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
||||||
@ -40,7 +42,9 @@ function TermsOfServiceDialog() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<DialogClose>Agree</DialogClose>
|
<DialogClose onClick={() => {
|
||||||
|
localStorage.setItem(termAcceptedCacheKey, 'true');
|
||||||
|
}}>Agree</DialogClose>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user