File tree Expand file tree Collapse file tree 1 file changed +0
-5
lines changed Expand file tree Collapse file tree 1 file changed +0
-5
lines changed Original file line number Diff line number Diff line change 11const API_URL = 'http://localhost:8080' ; //url do app, vou add dps
22
33export const productService = {
4- // Listar produtos
54 async getProducts ( ) {
65 const response = await fetch ( `${ API_URL } /products` ) ;
76 return response . json ( ) ;
87 } ,
98
10- // Criar produto
119 async createProduct ( product ) {
1210 const response = await fetch ( `${ API_URL } /products` , {
1311 method : 'POST' ,
@@ -19,13 +17,11 @@ export const productService = {
1917 return response . json ( ) ;
2018 } ,
2119
22- // Buscar produto por ID
2320 async getProduct ( id ) {
2421 const response = await fetch ( `${ API_URL } /products/${ id } ` ) ;
2522 return response . json ( ) ;
2623 } ,
2724
28- // Atualizar produto
2925 async updateProduct ( id , product ) {
3026 const response = await fetch ( `${ API_URL } /products/${ id } ` , {
3127 method : 'PUT' ,
@@ -37,7 +33,6 @@ export const productService = {
3733 return response . json ( ) ;
3834 } ,
3935
40- // Deletar produto
4136 async deleteProduct ( id ) {
4237 await fetch ( `${ API_URL } /products/${ id } ` , {
4338 method : 'DELETE' ,
You can’t perform that action at this time.
0 commit comments