From bbd9af10090e0e2f6b0edfa1a51cddc0ea0c56b2 Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Tue, 6 Aug 2024 21:22:59 +0700 Subject: [PATCH] Create api.js --- blockchain_integration/PiSure/client/utils/api.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 blockchain_integration/PiSure/client/utils/api.js diff --git a/blockchain_integration/PiSure/client/utils/api.js b/blockchain_integration/PiSure/client/utils/api.js new file mode 100644 index 000000000..02a4614c2 --- /dev/null +++ b/blockchain_integration/PiSure/client/utils/api.js @@ -0,0 +1,11 @@ +import axios from 'axios'; + +const api = axios.create({ + baseURL: '/api', +}); + +export const createPolicy = (data) => api.post('/policies', data); +export const getPolicies = () => api.get('/policies'); +export const getPolicy = (id) => api.get(`/policies/${id}`); +export const updatePolicy = (id, data) => api.put(`/policies/${id}`, data); +export const deletePolicy = (id) => api.delete(`/policies/${id}`);