Skip to content

Commit

Permalink
fix: im feeling lucky now working
Browse files Browse the repository at this point in the history
  • Loading branch information
JusJira committed Oct 30, 2023
1 parent 7c83c97 commit 943cc46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/api/product/random/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ export async function GET(req: Request) {
id: true,
},
});
const url = process.env.KINDE_SITE_URL + '/product/' + product[0].id

return new Response(JSON.stringify(product));
return new Response(JSON.stringify(url));
} catch (error) {
if (error instanceof z.ZodError) {
return new Response(JSON.stringify(error.issues), { status: 422 });
Expand Down
3 changes: 2 additions & 1 deletion app/product/ProductSearchPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ const ProductSearchPanel = ({ path }: { path: string }) => {
const url = await fetch("/api/product/random");
if (url.ok) {
const data = await url.json();
window.location.href = "https://chad.jjus.dev/product/" + data[0].id;
// console.log(data)
window.location.href = data
setRandoming(false);
}
};
Expand Down

0 comments on commit 943cc46

Please sign in to comment.