feat: get versions

This commit is contained in:
Artemy 2023-06-18 18:52:39 +03:00
parent dfa54d3f65
commit 4a5b47e054
4 changed files with 90 additions and 4 deletions

36
components/utils.js Normal file
View file

@ -0,0 +1,36 @@
const axios = require("axios");
async function getVersions() {
return (
await axios.get(
"https://launchermeta.mojang.com/mc/game/version_manifest_v2.json"
)
).data.versions;
}
async function getLatestVersion() {
return getVersions()[0];
}
async function getLatestRelease() {
return (
await axios.get(
"https://launchermeta.mojang.com/mc/game/version_manifest_v2.json"
)
).data.latest.release;
}
async function getLatestSnapshot() {
return (
await axios.get(
"https://launchermeta.mojang.com/mc/game/version_manifest_v2.json"
)
).data.latest.snapshot;
}
module.exports = {
getVersions,
getLatestVersion,
getLatestRelease,
getLatestSnapshot,
};