cos tam dziala

This commit is contained in:
Patryk Koreń
2026-07-06 23:17:37 +02:00
parent e7ec832f5b
commit ff707dd762
26 changed files with 494 additions and 60 deletions

View File

@@ -1,19 +1,38 @@
import { apiFetch } from "@/api/auth";
import { Button } from "@/components/ui/button";
import { useEffect, useState } from "react";
export function Video() {
const [video, setVideo] = useState<string | null>(null);
const getVideo = async () => {
const res = await apiFetch("/protected/video");
const txt = await res.text()
setVideo(txt)
const refresh = async () => {
await apiFetch(`/protected/refreshfiles`, {
method: "POST",
});
}
useEffect(() => {
getVideo()
}, [])
const create = async () => {
await apiFetch(`/protected/createclip`, {
method: "POST",
});
}
return (
<div className="flex flex-1 flex-col gap-4 py-16">
{video}
<div>
<Button
onClick={() => { refresh() }}
>Refresh</Button>
<Button
onClick={() => { create() }}
>Create Clip</Button>
</div>
<video controls width="600">
<source
src={`${import.meta.env.VITE_API_URL}/protected/video`}
type="video/mp4"
/>
Your browser does not support the video tag.
</video>
</div>
);
}