add api with example usage
This commit is contained in:
parent
3c0d84c628
commit
9f14b74575
7
src/api.js
Normal file
7
src/api.js
Normal file
@ -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
|
||||
)
|
||||
}
|
@ -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(<App />, createRootElement())
|
||||
|
||||
getMap(10, 20).then(map => {
|
||||
console.log(map)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user