Skip to content

Commit

Permalink
Merge pull request #33 from planetarium/use-mimir-for-avatar
Browse files Browse the repository at this point in the history
Use mimir for avatar
  • Loading branch information
boscohyun authored May 21, 2024
2 parents 52657be + b3c322f commit 85df429
Show file tree
Hide file tree
Showing 7 changed files with 237 additions and 216 deletions.
13 changes: 13 additions & 0 deletions apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ export async function getSheet(
});
}

export async function getAvatar(
nodeType: NodeType,
networkType: NetworkType,
address: string
): Promise<any | null> {
try {
return await fetchAPI<any>(nodeType, `${networkType}/avatars/${address}`);
}
catch (error) {
return null;
}
}

export async function getAvatarInventory(
nodeType: NodeType,
networkType: NetworkType,
Expand Down
9 changes: 7 additions & 2 deletions pages/[network]/agent/[address].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,17 @@ const AgentPage: NextPage<AgentPageProps> = ({ agent, blockIndex }) => {
}

export const getServerSideProps: GetServerSideProps<AgentPageProps> = async (context) => {
const network = context.query.network;
if (typeof(network) !== "string") {
throw new Error("Network parameter is not a string.");
}

const address = context.query.address;
if (typeof (address) !== "string") {
if (typeof(address) !== "string") {
throw new Error("Address parameter is not a string.");
}

const sdk = networkToSDK(context);
const sdk = networkToSDK(network);

const blockIndexString = context.query.blockIndex;
const blockIndex = blockIndexString === undefined ? -1 : Number(blockIndexString);
Expand Down
Loading

0 comments on commit 85df429

Please sign in to comment.