Skip to content
Snippets Groups Projects
Commit ccbc4552 authored by Anthony's avatar Anthony
Browse files

Manifest found display as ul

parent c4b38472
No related branches found
No related tags found
No related merge requests found
......@@ -27,13 +27,17 @@ class CanvasListItem extends Component {
/** */
componentDidMount() {
const searchManifest = async () => {
const manifests = await searchManifestAndAddButton(this.props.children[0][0].props.children[0].props.htmlString);
console.log(this.props);
searchManifestAndAddButton(this.props.children[0][0].props.children[0].props.htmlString)
.then((values) => {
if (values) {
console.log(values);
this.setState({
manifests,
manifests: values.flat(),
});
console.log(this.state);
}
});
};
searchManifest();
}
/** */
......@@ -141,7 +145,11 @@ class CanvasListItem extends Component {
>
{children}
</li>
<h2>{manifests}</h2>
{manifests &&
<ul>
{manifests.map((object) => (<li> {object} </li>)) }
</ul>
}
</div>
);
}
......
......@@ -22,7 +22,7 @@ export function secondsToHMSarray(secs) {
return [h, Math.floor(secs / 60) - h * 60, secs % 60];
}
/** */
export function searchManifestAndAddButton(html) {
export async function searchManifestAndAddButton(html) {
const urls = html.match(
/((http|https)\:\/\/[a-z0-9\/:%_+.,#?!@&=-]+)/g,
);
......@@ -35,18 +35,15 @@ export function searchManifestAndAddButton(html) {
return request;
});
Promise.all(requestsArray.map((request) => {
return Promise.all(requestsArray.map((request) => {
return fetch(request).then((response) => {
return response.json();
}).then((data) => {
if (data.type === 'Manifest') {
return data;
return data.id;
}
return null;
});
})).then((values) => {
console.log('values', values);
return values;
});
}));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment