import axios, { AxiosPromise, AxiosRequestConfig, AxiosResponse } from 'axios' import {ApiObject, CreateGameObject} from "@/objects/objects"; export default class PerudoApi { private static baseUrl = 'http://localhost:8000/' private static objectInstance?: PerudoApi; public static get instance(): PerudoApi { if(typeof PerudoApi.objectInstance === 'undefined') { PerudoApi.objectInstance = new PerudoApi(); } return PerudoApi.objectInstance; } public createGame(name: string):Promise { return this.get(PerudoApi.baseUrl + 'game/create?name=' + name) .then((response: AxiosResponse) => { return response.data; }) } private get(url: string, getParameters?: Record) { return axios.get(url).then((response: AxiosResponse) => { return response; }) } }