diff --git a/src/app/congratulations/page.tsx b/src/app/congratulations/page.tsx index 60a18b4..6dfadd7 100644 --- a/src/app/congratulations/page.tsx +++ b/src/app/congratulations/page.tsx @@ -39,7 +39,7 @@ export default function Congratulations() { - {selectedOption === 'rare' ? ( + {selectedOption === 'limited' ? ( diff --git a/src/app/launch-congratulation/page.tsx b/src/app/launch-congratulation/page.tsx index bfd2eb5..6160342 100644 --- a/src/app/launch-congratulation/page.tsx +++ b/src/app/launch-congratulation/page.tsx @@ -3,14 +3,47 @@ import { useSearchParams } from 'next/navigation' import { Button, Navbar } from '@/components' import Link from 'next/link' import { Suspense } from 'react' +import React, { useEffect, useState } from 'react'; export default function Congratulations() { const searchParams = useSearchParams() + const [phygitalName, setPhygitalName] = useState(''); const brand_name = searchParams.get('brand_name') const PhygitalId = localStorage.getItem('PhygitalId'); const WebxrId = localStorage.getItem('WebxrId'); + useEffect(() => { + const phygitalmatch = async () => { + const baseUri = process.env.NEXT_PUBLIC_URI || 'https://app.myriadflow.com'; + try { + const phyres = await fetch(`${baseUri}/phygitals/all/554b4903-9a06-4031-98f4-48276c427f78`, { + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }); + + if (!phyres.ok) { + throw new Error('Failed to fetch data'); + } + + const phyresult = await phyres.json(); + + const matchingPhy = phyresult.find((phy: { id: any }) => phy.id === PhygitalId); + + if (matchingPhy) { + const phygitalName = matchingPhy.name; + setPhygitalName(phygitalName); + } + } catch (error) { + console.error('Error fetching data:', error); + } + } + + phygitalmatch(); + }, []) + return ( @@ -28,13 +61,13 @@ export default function Congratulations() { Launch Another Collection - + - +