Added single page to router and API calls

This commit is contained in:
Alexis
2021-03-05 16:46:15 +01:00
parent f5af25e0f0
commit 4a2ba19aa5
4 changed files with 73 additions and 10 deletions

View File

@@ -15,7 +15,6 @@ import CelestialsList from "@/components/celestials/CelestialsList.vue";
// API
import axios from "axios";
// Global methods
import { addCelestialType } from "@/plugins/methods";
@@ -32,20 +31,19 @@ export default defineComponent({
};
},
async mounted() {
mounted() {
// Fetches from API...
this.fetchBodies().then(res => {
this.fetchCelestials().then(res => {
// ...and add type
this.celestials = this.addType(res);
});
console.log(this.$options);
},
methods: {
/**
* Fetches celestial bodies from API
*/
fetchBodies(): Promise<any> {
fetchCelestials(): Promise<any> {
return axios
.get("https://api.le-systeme-solaire.net/rest/bodies/")
.then(res => {