Skip to content

Commit

Permalink
modified files for deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
firasbk7770 committed Jul 2, 2024
1 parent a608107 commit 1930181
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
19 changes: 8 additions & 11 deletions src/app/testnet/[id]/page.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import PublicNet from "./testnet";

export async function generateStaticParams() {
// Fetch or define the possible values for `id`
const ids = []; // Example ids
return ids.map(id => ({ id }));
}

const PublicPage = ({ params }) => {
const { id: accountId } = params; // Assuming `params` contains an `id` field
return <PublicNet accountId={accountId} />;
const { id } = params;
return <PublicNet id={id} />;
};

export async function getServerSideProps(context) {
const { id } = context.params; // Get the `id` from the context
return {
props: {
params: { id }
}
};
}

export default PublicPage;
11 changes: 9 additions & 2 deletions src/app/testnet/[id]/testnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import React, { useEffect, useState } from "react";
import Link from "next/link"; // Import Link for client-side navigation
import { usePublic } from "@/context/net";

const PublicNet = ({ accountId }) => {
const [account, setAccount] = useState(accountId);
const PublicNet = ({ props }) => {
const [account, setAccount] = useState("");
const [net, setNet] = usePublic();
const [information, setInformation] = useState({});
const [exists, setExists] = useState(true);
Expand All @@ -26,6 +26,13 @@ const PublicNet = ({ accountId }) => {
const [loading, setLoading] = useState(false);
console.log(net);

useEffect(() => {
const pathname = window.location.pathname;
const accountId = pathname.substring(pathname.lastIndexOf("/") + 1);

setAccount(accountId);
}, []);

useEffect(() => {
const pathname = window.location.pathname;
const accountId = pathname.substring(pathname.lastIndexOf("/") + 1);
Expand Down

0 comments on commit 1930181

Please sign in to comment.