Skip to content

Commit

Permalink
fixing build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cool-ant committed Mar 14, 2024
1 parent 718b417 commit 640e0bf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
1 change: 1 addition & 0 deletions services/user/NftSys/include/services/user/NftSys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ namespace UserService
method(debit, nftId, memo),
method(setUserConf, flag, enable),
method(serveSys, request),
method(storeSys, path, contentType, content),

method(getNft, nftId),
method(getNftHolder, account),
Expand Down
38 changes: 22 additions & 16 deletions services/user/NftSys/ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,53 @@ import { Heading, NftTable, SendMintNft } from "./components";
import WalletIcon from "./assets/icon-wallet.svg?react";

export type Nft = {
id: string;
id: number;
status: "owned" | "burned" | "pending-debit" | "pending-credit";
counterParty?: string;
};

const nfts: Nft[] = [
{
id: "1",
id: 1,
status: "owned",
},
{
id: "2",
id: 2,
status: "pending-debit",
counterParty: "brandon",
},
{
id: "3",
id: 3,
status: "pending-credit",
counterParty: "james",
},
];

function App() {
const [resMint, setResMint] = useState("Empty");
const [supervisor, setSupervisor] = useState<Supervisor>();

const init = async () => {
const supervisor = new Supervisor();
console.info("nft finding supervisor==null");
if (!supervisor) return;
console.info("nft waiting for supervisor loaded");
await supervisor.onLoaded();
supervisor.preLoadServices(["nft-sys"]);
console.info("nft-sys connected to Supervisor and plugins preloaded");
};

useEffect(() => {
init();
console.info("nft-sys connected to Supervisor");
}, []);
}, [supervisor]);

const supervisor = new Supervisor();
useEffect(() => {
console.info("nft-sys -> new Supervisor()");
setSupervisor(new Supervisor());
}, []);
const mintNft = async () => {
if (!supervisor.onLoaded()) return;
if (!supervisor?.onLoaded()) return;

console.log("calling nft-sys.callintoplugin");
console.log("calling nft-sys.call(mintNft())");
const res = await supervisor.functionCall({
service: "nft-sys",
method: "mint",
Expand All @@ -56,9 +62,9 @@ function App() {
};

const burnNft = async (nftId: number) => {
if (!supervisor.onLoaded()) return;
if (!supervisor?.onLoaded()) return;

console.log("calling nft-sys.callintoplugin");
console.log("calling nft-sys.call(burnNft())");
const res = await supervisor.functionCall({
service: "nft-sys",
method: "burn",
Expand All @@ -68,9 +74,9 @@ function App() {
};

const uncreditNft = async (nftId: number) => {
if (!supervisor.onLoaded()) return;
if (!supervisor?.onLoaded()) return;

console.log("calling nft-sys.callintoplugin");
console.log("calling nft-sys.call(uncreditNft))");
const res = await supervisor.functionCall({
service: "nft-sys",
method: "uncredit",
Expand All @@ -80,9 +86,9 @@ function App() {
};

const debitNft = async (nftId: number) => {
if (!supervisor.onLoaded()) return;
if (!supervisor?.onLoaded()) return;

console.log("calling nft-sys.callintoplugin");
console.log("calling nft-sys.call(debitNft())");
const res = await supervisor.functionCall({
service: "nft-sys",
method: "debit",
Expand Down
10 changes: 5 additions & 5 deletions services/user/NftSys/ui/src/components/nft-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface Props {

export const NftTable = ({
nfts,
actionHandlers: _actionHandlers,
actionHandlers,
queryResult: result = { isLoading: false, isError: false },
}: Props) => {
if (result.isLoading) {
Expand All @@ -52,7 +52,7 @@ export const NftTable = ({
);
}

// const { burnNft, uncreditNft, debitNft } = actionHandlers;
const { burnNft, uncreditNft, debitNft } = actionHandlers;
return (
<section className="mt-3 space-y-3">
<Heading tag="h2" className="select-none font-medium text-gray-600">
Expand Down Expand Up @@ -93,7 +93,7 @@ export const NftTable = ({
size="xs"
fullWidth
className="text-red-500"
// onClick={() => burnNft(nft.id)}
onClick={() => burnNft(nft.id)}
>
Burn
</Button>
Expand All @@ -102,7 +102,7 @@ export const NftTable = ({
size="xs"
fullWidth
className="text-green-500"
// onClick={() => debitNft(nft.id)}
onClick={() => debitNft(nft.id)}
>
Claim
</Button>
Expand All @@ -111,7 +111,7 @@ export const NftTable = ({
size="xs"
fullWidth
className="w-24"
// onClick={() => uncreditNft(nft.id)}
onClick={() => uncreditNft(nft.id)}
>
Uncredit
</Button>
Expand Down

0 comments on commit 640e0bf

Please sign in to comment.