mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-06 21:44:13 +03:00
17 lines
366 B
TypeScript
17 lines
366 B
TypeScript
|
|
import copy from "copy-to-clipboard";
|
||
|
|
import { toast } from "sonner";
|
||
|
|
|
||
|
|
export function shareOrCopy(url: string, title?: string) {
|
||
|
|
if (window.isSecureContext && "share" in navigator) {
|
||
|
|
navigator.share({
|
||
|
|
url: url,
|
||
|
|
title: title,
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
copy(url);
|
||
|
|
toast.success("Copied to clipboard.", {
|
||
|
|
position: "top-center",
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|