Created
September 4, 2021 13:14
-
-
Save Mythbusters123/b1c61471e8f54ae7fcc0d9b7c0995915 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from "axios"; | |
import Head from "next/head"; | |
import { Component } from "react"; | |
import styles from "../../styles/Home.module.css"; | |
export default class MythicAddons extends Component { | |
constructor() { | |
super({}); | |
this.json; | |
console.log(this.getJson) | |
} | |
state = { | |
Jars: this.convertJson(), | |
}; | |
componentDidMount() { | |
this.setState({ Jars: this.convertJson() }); | |
} | |
render() { | |
const jars = this.state.Jars?.forEach((k, v) => { | |
return ( | |
<li key={v}> | |
<a href={k}>{v}</a> | |
</li> | |
); | |
}); | |
return ( | |
<div> | |
<Head> | |
<meta | |
name="description" | |
content="Downloads for MythicAddons, all versions" | |
/> | |
<title>Downloads -- MythicAddons</title> | |
<link href="/favicon.ico" rel="icon" /> | |
</Head> | |
<main className={styles.main}> | |
<h1 className={styles.title}>MythicAddons Downloads</h1> | |
<h3 className={styles.description}> | |
<ul>{jars}</ul> | |
</h3> | |
</main> | |
</div> | |
); | |
} | |
async getJson() { | |
return await ( | |
await axios.get("http://localhost:3000/api/downloads/mythic-addons") | |
).data; | |
} | |
convertJson() { | |
return new Map( | |
Object.entries( | |
this.getJson().then((json) => { | |
return json; | |
}) | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment