* Sample template created * added findByName functionality for item * Solve Cors errors and inhibit DefaultExposure * changed project structure * Added frontend * Creation of base template (#1) * changed base path of REST api and updated frontend api quering
20 lines
545 B
JavaScript
20 lines
545 B
JavaScript
import axios from 'axios'
|
|
|
|
const SERVER_URL = 'http://localhost:9000'
|
|
|
|
const instance = axios.create({
|
|
baseURL : SERVER_URL,
|
|
timeout: 1000
|
|
})
|
|
|
|
export default {
|
|
createNew: (name, quantity, unit) => instance.post("/api/v1/items", {name: name, quantity : quantity, unit : unit}),
|
|
|
|
getAll: () => instance.get('/api/v1/items', {
|
|
transformResponse: [function (data) {
|
|
return data? JSON.parse(data)._embedded.items : data;
|
|
}]
|
|
}),
|
|
|
|
removeForId: (id) => instance.delete('/api/v1/items/'+ id)
|
|
} |