Base générale d'UI
This commit is contained in:
24
client/src/util/api.js
Normal file
24
client/src/util/api.js
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
export class APIClient {
|
||||
|
||||
saveBoard(board) {
|
||||
return fetch(`/api/boards`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(board)
|
||||
})
|
||||
.then(res => res.json())
|
||||
;
|
||||
}
|
||||
|
||||
fetchBoards() {
|
||||
return fetch(`/api/boards`)
|
||||
.then(res => res.json())
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const api = new APIClient();
|
Reference in New Issue
Block a user