fix: broken json (#66)
* fix: fix broken json error. saving the description correctly * fix: fix pr review comments * fix: fix text display when theres no breakline * fix: fix break lines text on details view. Move the \n replacing to the lib
This commit is contained in:
parent
23dc080c7a
commit
99155edf2f
|
|
@ -10,7 +10,7 @@ export const FleekERC721 = {
|
|||
const response = await contract.mint(
|
||||
params.owner,
|
||||
params.name,
|
||||
params.description,
|
||||
params.description.replaceAll(/\n/g, '\\n'), //replace break lines with \\n so it doesn't break the json,
|
||||
params.image,
|
||||
params.externalUrl,
|
||||
params.ens,
|
||||
|
|
@ -27,7 +27,9 @@ export const FleekERC721 = {
|
|||
const response = await contract.tokenURI(Number(tokenId));
|
||||
|
||||
const parsed = JSON.parse(
|
||||
Buffer.from(response.slice(29), 'base64').toString('utf-8')
|
||||
Buffer.from(response.slice(29), 'base64')
|
||||
.toString('utf-8')
|
||||
.replaceAll(/\n/g, '\\n') // replace escaped newlines
|
||||
);
|
||||
|
||||
return parsed;
|
||||
|
|
@ -35,7 +37,7 @@ export const FleekERC721 = {
|
|||
|
||||
async lastTokenId(): Promise<number> {
|
||||
// TODO: fetch last token id
|
||||
return 6;
|
||||
return 7;
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,15 @@ export const MintedSiteDetail = () => {
|
|||
heading="Description"
|
||||
minH={120}
|
||||
maxH="auto"
|
||||
children={<p>{description}</p>}
|
||||
children={
|
||||
<p
|
||||
style={{
|
||||
whiteSpace: 'pre-line',
|
||||
}}
|
||||
>
|
||||
{description}
|
||||
</p>
|
||||
}
|
||||
/>
|
||||
<AccordionItem
|
||||
heading="Attributes"
|
||||
|
|
|
|||
Loading…
Reference in New Issue