productApi.ts

POS-System · src/services/productApi.ts · typescript · MIT
integration, database, pos, tag:product-management

Client-side API module handling product CRUD operations through HTTP requests to /product endpoints.

// Source: https://github.com/AhmadEleiwa/POS-System | License: MIT | Copyright 2023 Ahmad Ilawa
// Provided via justclaw.it.com; keep this notice with the code.
import { apiClient } from "../config/api";

export const productApi = {
  getAll: async () => {
    const response = await apiClient.get("/product/products");
    return response.data;
  },

  create: async (formData: FormData) => {
    const response = await apiClient.post("/product/new", formData);
    return response.data;
  },

  update: async (productId: string, formData: FormData) => {
    const response = await apiClient.post(`/product/update/${productId}`, formData);
    return response.data;
  },

  delete: async (productId: string) => {
    const response = await apiClient.delete(`/product/delete/${productId}`);
    retu

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key