fix
This commit is contained in:
@@ -7,12 +7,14 @@ import type { Clip } from "../utils/types";
|
||||
const MyClips = () => {
|
||||
const [clips, setClips] = useState<Clip[]>([]);
|
||||
const [error, setError] = useState<null | string>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
getClips()
|
||||
.then((data) => setClips(data.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())))
|
||||
.catch((err) => setError(err));
|
||||
.catch((err) => setError(err))
|
||||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
@@ -42,7 +44,7 @@ const MyClips = () => {
|
||||
))}
|
||||
</div>
|
||||
|
||||
{clips.length === 0 && !error && (
|
||||
{clips.length === 0 && !error && !loading && (
|
||||
<div className="flex flex-col items-center justify-center py-16 text-muted">
|
||||
<p className="text-base">No clips yet.</p>
|
||||
<p className="text-sm mt-1">Upload your first clip to get started.</p>
|
||||
|
||||
@@ -7,12 +7,14 @@ import type { Vod } from "../utils/types";
|
||||
const MyVods = () => {
|
||||
const [vods, setVods] = useState<Vod[]>([]);
|
||||
const [error, setError] = useState<null | string>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
getVods()
|
||||
.then((data) => setVods(data.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())))
|
||||
.catch((err) => setError(err instanceof Error ? err.message : "Failed to load vods"));
|
||||
.catch((err) => setError(err instanceof Error ? err.message : "Failed to load vods"))
|
||||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
@@ -45,7 +47,7 @@ const MyVods = () => {
|
||||
))}
|
||||
</div>
|
||||
|
||||
{vods.length === 0 && !error && (
|
||||
{vods.length === 0 && !error && !loading && (
|
||||
<div className="flex flex-col items-center justify-center py-16 text-muted">
|
||||
<p className="text-base">No VoDs yet.</p>
|
||||
<p className="text-sm mt-1">Your stream recordings will appear here.</p>
|
||||
|
||||
Reference in New Issue
Block a user