Skip to content

Commit 7965f94

Browse files
committed
πŸ›΅πŸ„πŸ» ↝ [SSG-62]: I have no idea why this is happening
1 parent 8f37fb8 commit 7965f94

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

β€Žapp/starnet/feed/page.tsx

+23-12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ import { PostCardSingle } from "@/content/Posts/PostSingle";
55
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
66
import StarnetLayout from "@/components/Layout/Starnet";
77

8+
interface Classification {
9+
id: number;
10+
created_at: string;
11+
content: string | null;
12+
author: string | null;
13+
anomaly: number | null;
14+
media: any | null;
15+
classificationtype: string | null;
16+
classificationConfiguration: any | null;
17+
};
18+
819
export default function Starnet() {
920
const supabase = useSupabaseClient();
1021
const session = useSession();
@@ -19,41 +30,41 @@ export default function Starnet() {
1930
setLoading(false);
2031
return;
2132
}
22-
33+
2334
setLoading(true);
2435
setError(null);
2536
try {
2637
const { data, error } = await supabase
27-
.from("classifications")
28-
.select("*, classificationConfiguration, classificationtype")
29-
.eq("author", session.user.id)
30-
.order("created_at", { ascending: false });
31-
38+
.from('classifications')
39+
.select('*')
40+
.eq('author', session.user.id)
41+
.order('created_at', { ascending: false }) as { data: Classification[]; error: any };
42+
3243
if (error) throw error;
33-
44+
3445
const processedData = data.map((classification) => {
3546
const media = classification.media;
3647
let images: string[] = [];
37-
48+
3849
if (Array.isArray(media) && media.length === 2 && typeof media[1] === "string") {
3950
images.push(media[1]);
4051
} else if (media && media.uploadUrl) {
4152
images.push(media.uploadUrl);
4253
}
43-
54+
4455
const votes = classification.classificationConfiguration?.votes || 0;
45-
56+
4657
return { ...classification, images, votes };
4758
});
48-
59+
4960
setClassifications(processedData);
5061
} catch (error) {
5162
console.error("Error fetching classifications:", error);
5263
setError("Failed to load classifications.");
5364
} finally {
5465
setLoading(false);
5566
}
56-
};
67+
};
5768

5869
useEffect(() => {
5970
fetchClassifications();

0 commit comments

Comments
Β (0)