diff --git a/src/admin/vote/Results.jsx b/src/admin/vote/Results.jsx
index d27ba8c..74143ac 100644
--- a/src/admin/vote/Results.jsx
+++ b/src/admin/vote/Results.jsx
@@ -222,8 +222,9 @@ export default function Results() {
{
options.find((option) => option.id === result.result)
- .title
+ ?.title
}
+ {result.result}
|
))}
@@ -252,7 +253,7 @@ export default function Results() {
{
options.find((option) => option.id === result.result)
- .title
+ ?.title
}
|
@@ -501,15 +502,18 @@ export default function Results() {
);
}
-Results.loader = async function loader({ params }) {
+Results.loader = async function loader({ params }) {
const { id } = params;
+ console.log(id);
const vote = await getDoc(doc(db, `/votes/${id}`));
- const voteData = { id: vote.id, ...vote.data() };
+ const voteData = { id, ...vote.data() };
+ console.log(voteData);
const options = (
await getDocs(collection(db, `/votes/${id}/options`))
).docs.map((doc) => {
- return { id, ...doc.data() };
+ return { id: doc.id, ...doc.data() };
});
+ console.log(options);
const results = (
await getDocs(collection(db, `/votes/${id}/results`))
@@ -529,4 +533,4 @@ Results.loader = async function loader({ params }) {
results,
choices,
};
-}
+};