2026-11-19 09:26:06 +00:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { useEffect } from "react";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reports a visit of the share page from the visitor's browser. Link preview
|
2026-11-21 21:13:41 +00:00
|
|
|
* 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).
|
2026-11-19 09:26:06 +00:00
|
|
|
*/
|
|
|
|
|
export function ShareVisit({ slug }: { slug: string }) {
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetch(`/api/v1/public/shares/${slug}/visit`, { method: "POST", credentials: "same-origin" }).catch(() => {});
|
|
|
|
|
}, [slug]);
|
|
|
|
|
return null;
|
|
|
|
|
}
|