stage 3
This commit is contained in:
24
web/src/lib/api.js
Normal file
24
web/src/lib/api.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import fetch from 'isomorphic-fetch';
|
||||
import {BASE_URL} from '../config';
|
||||
|
||||
export const getAllIntents = ()=>{
|
||||
let url = `http://${BASE_URL}/intents`
|
||||
return fetch(url, {method: 'GET'});
|
||||
}
|
||||
|
||||
export const deleteIntent = id=>{
|
||||
let url = `http://${BASE_URL}/deleteIntent/${id}`
|
||||
return fetch(url, {method: 'GET'});
|
||||
}
|
||||
|
||||
export const updateIntent = (id,intent)=>{
|
||||
let url = `http://${BASE_URL}/updateIntent/${id}`
|
||||
return fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(intent),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user