24 lines
589 B
TypeScript
24 lines
589 B
TypeScript
import { API_URL } from "@/core/constant";
|
|
interface PageProps {
|
|
params: Promise<{ id: string }>;
|
|
}
|
|
|
|
async function getTicket(id: string) {
|
|
const res = await fetch(`${API_URL}/ticket/get/${id}`, {
|
|
cache: "no-store", // برای اینکه همیشه دیتای تازه از سرور بگیرد
|
|
});
|
|
if (!res.ok) {
|
|
throw new Error("Error");
|
|
}
|
|
|
|
const data = await res.json();
|
|
return data;
|
|
}
|
|
|
|
export default async function Page({ params }: PageProps) {
|
|
const { id } = await params;
|
|
const getdata = await getTicket(id);
|
|
console.log(getdata)
|
|
return <div></div>;
|
|
}
|