feat/analytics #9
@ -1,25 +0,0 @@
|
||||
import type { PageContext } from "vike/types";
|
||||
|
||||
import { getTelefuncContext } from "@/lib/getTelefuncContext";
|
||||
import { CookieParser } from "@/services/CookieParser";
|
||||
|
||||
type ConsentCookies = keyof PageContext["cookies"]["consent"];
|
||||
|
||||
export async function onUpdateConsentCookie(cookieName: ConsentCookies, cookieValue: boolean) {
|
||||
const context = getTelefuncContext();
|
||||
const { reply } = context;
|
||||
|
||||
CookieParser.set(reply, cookieName, cookieValue.toString(), 365);
|
||||
|
||||
return { ok: true, message: "Updated consent cookie", cookieName, cookieValue };
|
||||
}
|
||||
|
||||
export async function onAcceptAllConsentCookie() {
|
||||
const context = getTelefuncContext();
|
||||
const { reply } = context;
|
||||
|
||||
CookieParser.set(reply, "analytics", "true", 365);
|
||||
CookieParser.set(reply, "customization", "true", 365);
|
||||
|
||||
return { ok: true, message: "Updated consents cookies" };
|
||||
}
|
||||
@ -1,8 +1,11 @@
|
||||
import { Link } from "@/components/common/Link";
|
||||
import { CookiesContext } from "@/components/common/Cookies";
|
||||
import { Button } from "@/components/syntax/Button";
|
||||
import React from "react";
|
||||
import { Link } from "@/components/common/Link";
|
||||
import React, { useContext } from "react";
|
||||
|
||||
export function Page() {
|
||||
const { setIsOpen } = useContext(CookiesContext);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4 p-4">
|
||||
<h1 className="font-display text-3xl tracking-tight text-slate-900 dark:text-white">
|
||||
@ -79,13 +82,7 @@ export function Page() {
|
||||
paragraphe.
|
||||
</p>
|
||||
|
||||
<Button
|
||||
variant="secondary"
|
||||
className="w-max max-w-full"
|
||||
onClick={() => {
|
||||
// TODO
|
||||
}}
|
||||
>
|
||||
<Button variant="secondary" className="w-max max-w-full" onClick={() => setIsOpen(true)}>
|
||||
Paramétrer les cookies
|
||||
</Button>
|
||||
|
||||
|
||||
0
app/providers/ThemeProvider.telefunc.ts
Normal file
0
app/providers/ThemeProvider.telefunc.ts
Normal file
Loading…
Reference in New Issue
Block a user