diff --git a/src/api.js b/src/api.js new file mode 100644 index 0000000..7dbf980 --- /dev/null +++ b/src/api.js @@ -0,0 +1,7 @@ +import Axios from 'axios' + +export function getMap(x, y) { + return Axios.get(`http://169.254.61.222:5000/generate/${x}/${y}`).then( + data => data.data + ) +} diff --git a/src/index.js b/src/index.js index a6fc942..446baf6 100644 --- a/src/index.js +++ b/src/index.js @@ -4,6 +4,7 @@ import React from 'react' import ReactDOM from 'react-dom' import { App } from './App' +import { getMap } from './api' function createRootElement() { const body = document.getElementsByTagName('body')[0] @@ -13,3 +14,7 @@ function createRootElement() { return root } ReactDOM.render(, createRootElement()) + +getMap(10, 20).then(map => { + console.log(map) +})