Fix copying logs (#5373)

This commit is contained in:
Nicolas Mowen 2023-02-03 18:32:31 -07:00 committed by GitHub
parent 66881eb89f
commit 74d6ab0555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import { useCallback, useEffect, useState } from 'preact/hooks';
import ButtonsTabbed from '../components/ButtonsTabbed'; import ButtonsTabbed from '../components/ButtonsTabbed';
import useSWR from 'swr'; import useSWR from 'swr';
import Button from '../components/Button'; import Button from '../components/Button';
import copy from 'copy-to-clipboard';
export default function Logs() { export default function Logs() {
const [logService, setLogService] = useState('frigate'); const [logService, setLogService] = useState('frigate');
@ -14,10 +15,7 @@ export default function Logs() {
const { data: nginxLogs } = useSWR('logs/nginx'); const { data: nginxLogs } = useSWR('logs/nginx');
const handleCopyLogs = useCallback(() => { const handleCopyLogs = useCallback(() => {
async function copy() { copy(logs);
await window.navigator.clipboard.writeText(logs);
}
copy();
}, [logs]); }, [logs]);
useEffect(() => { useEffect(() => {