Skip to content

Commit

Permalink
fixing storyObjects bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kylezryr committed Apr 22, 2024
1 parent ae7046d commit 8acb085
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/queries/savedStories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,10 @@ async function fetchUserStories(
}
}

const storyData = [];
for (const storyObject of storyObjects) {
const storyId = storyObject['story_id'];
const { data, error } = await supabase.rpc('fetch_story', {
input_id: storyId,
});

if (error || data.length == 0) {
if (process.env.NODE_ENV !== 'production') {
throw new Error(
`An error occured when trying to use rpc to get story data: ${JSON.stringify(
error,
)}`,
);
}
} else {
storyData.push(data[0]);
}
}
// console.log(data[0]);
// console.log("As preview:");
// console.log(data[0] as StoryPreview)
// console.log(data as StoryPreview[]);

return data as StoryPreview[];
}
Expand Down

0 comments on commit 8acb085

Please sign in to comment.