Proof of concept (#6)

* 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
This commit is contained in:
cato
2022-06-02 19:11:46 +02:00
committed by GitHub
parent edaf3c557e
commit f6385b40f6
32 changed files with 7031 additions and 0 deletions

20
frontend/src/Api.js Normal file
View File

@@ -0,0 +1,20 @@
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)
}