functional application without amazon update

This commit is contained in:
GotPPay
2017-12-02 22:48:45 +01:00
parent 0e193fa5a8
commit d5120a1ba2
12 changed files with 375 additions and 98 deletions

View File

@@ -1,24 +1,31 @@
import fetch from 'isomorphic-fetch';
import {BASE_URL} from '../config';
export const getAllIntents = ()=>{
let url = `http://${BASE_URL}/intents`
export const getAllIntents = (id)=>{
let url = `http://${BASE_URL}/intents/${id}`
return fetch(url, {method: 'GET'});
}
export const deleteIntent = id=>{
let url = `http://${BASE_URL}/deleteIntent/${id}`
export const getSkill = (id)=>{
let url = `http://${BASE_URL}/getSkill/${id}`
return fetch(url, {method: 'GET'});
}
export const updateIntent = (id,intent)=>{
let url = `http://${BASE_URL}/updateIntent/${id}`
export const deleteSkill = (id)=>{
let url = `http://${BASE_URL}/deleteSkill/${id}`
return fetch(url, {method: 'GET'});
}
export const updateSkill = (skill)=>{
console.log(skill);
let id = (skill._id) ? skill._id : -1;
let url = `http://${BASE_URL}/updateSkill/${id}`
return fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(intent),
body: JSON.stringify(skill),
});
}