/ Basic nuxt setup (some areas still broken)

This commit is contained in:
Alexis
2021-03-26 12:23:54 +01:00
parent 19ee29b936
commit 5ca4f4eceb
56 changed files with 19612 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
import axios from 'axios'
/**
* Fetches the API for all celestial bodies
* @returns Array of celestials in the API
*/
export const fetchCelestials = () => {
return axios
.get('https://api.le-systeme-solaire.net/rest/bodies/')
.then((res) => {
return res.data.bodies
})
}
/**
* Fetches the API for all celestial bodies
* @returns Array of celestials in the API
*/
export const fetchCelestial = (slug) => {
return axios
.get(`https://api.le-systeme-solaire.net/rest/bodies/${slug}`)
.then((res) => {
return res.data
})
}
export default {
fetchCelestials,
fetchCelestial
}