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(
|
const response = await contract.mint(
|
||||||
params.owner,
|
params.owner,
|
||||||
params.name,
|
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.image,
|
||||||
params.externalUrl,
|
params.externalUrl,
|
||||||
params.ens,
|
params.ens,
|
||||||
|
|
@ -27,7 +27,9 @@ export const FleekERC721 = {
|
||||||
const response = await contract.tokenURI(Number(tokenId));
|
const response = await contract.tokenURI(Number(tokenId));
|
||||||
|
|
||||||
const parsed = JSON.parse(
|
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;
|
return parsed;
|
||||||
|
|
@ -35,7 +37,7 @@ export const FleekERC721 = {
|
||||||
|
|
||||||
async lastTokenId(): Promise<number> {
|
async lastTokenId(): Promise<number> {
|
||||||
// TODO: fetch last token id
|
// TODO: fetch last token id
|
||||||
return 6;
|
return 7;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,15 @@ export const MintedSiteDetail = () => {
|
||||||
heading="Description"
|
heading="Description"
|
||||||
minH={120}
|
minH={120}
|
||||||
maxH="auto"
|
maxH="auto"
|
||||||
children={<p>{description}</p>}
|
children={
|
||||||
|
<p
|
||||||
|
style={{
|
||||||
|
whiteSpace: 'pre-line',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{description}
|
||||||
|
</p>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<AccordionItem
|
<AccordionItem
|
||||||
heading="Attributes"
|
heading="Attributes"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue