cos tam dziala
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user