Files
old-tellall/web/src/lib/api.js

30 lines
763 B
JavaScript
Raw Normal View History

2017-11-30 17:43:24 +01:00
import fetch from 'isomorphic-fetch';
import {BASE_URL} from '../config';
export const getAllIntents = (id)=>{
let url = `http://${BASE_URL}/intents/${id}`
2017-11-30 17:43:24 +01:00
return fetch(url, {method: 'GET'});
}
export const getSkill = (id)=>{
let url = `http://${BASE_URL}/getSkill/${id}`
2017-11-30 17:43:24 +01:00
return fetch(url, {method: 'GET'});
}
export const deleteSkill = (id)=>{
let url = `http://${BASE_URL}/deleteSkill/${id}`
return fetch(url, {method: 'GET'});
}
export const updateSkill = (skill)=>{
let id = (skill._id) ? skill._id : -1;
let url = `http://${BASE_URL}/updateSkill/${id}`
2017-11-30 17:43:24 +01:00
return fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(skill),
2017-11-30 17:43:24 +01:00
});
}