Skip to content

Commit

Permalink
Update api.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Bulletdev authored Dec 18, 2024
1 parent 193f18a commit 85e23c9
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions api.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
const API_URL = 'http://localhost:8080'; //url do app, vou add dps

export const productService = {
// Listar produtos
async getProducts() {
const response = await fetch(`${API_URL}/products`);
return response.json();
},

// Criar produto
async createProduct(product) {
const response = await fetch(`${API_URL}/products`, {
method: 'POST',
Expand All @@ -19,13 +17,11 @@ export const productService = {
return response.json();
},

// Buscar produto por ID
async getProduct(id) {
const response = await fetch(`${API_URL}/products/${id}`);
return response.json();
},

// Atualizar produto
async updateProduct(id, product) {
const response = await fetch(`${API_URL}/products/${id}`, {
method: 'PUT',
Expand All @@ -37,7 +33,6 @@ export const productService = {
return response.json();
},

// Deletar produto
async deleteProduct(id) {
await fetch(`${API_URL}/products/${id}`, {
method: 'DELETE',
Expand Down

0 comments on commit 85e23c9

Please sign in to comment.