Files
sorsfonalak/services/frontend/src/components/ShareVisit.tsx
T

18 lines
614 B
TypeScript
Raw Normal View History

"use client";
import { useEffect } from "react";
/**
* Reports a visit of the share page from the visitor's browser. Link preview
* robots do not run scripts, so only people are counted; the backend leaves
* out the sharer and counts the same visitor once in half an hour. Nothing is
* stored in the browser (the sharer who brought a new user travels in the
* login link instead).
*/
export function ShareVisit({ slug }: { slug: string }) {
useEffect(() => {
fetch(`/api/v1/public/shares/${slug}/visit`, { method: "POST", credentials: "same-origin" }).catch(() => {});
}, [slug]);
return null;
}