File size: 862 Bytes
6d643ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { BackendApiResponse } from '@/types';

import { apiClient } from './client';

export const scrapeApi = {
  // Get available brands for scraping
  getAvailableBrands: async (): Promise<string[]> => {
    const response =
      await apiClient.get<BackendApiResponse<string[]>>('/scrape/brands');
    return response.data.data;
  },

  // Start scraping for specific brand
  scrapeBrand: async (brand: string): Promise<{ message: string }> => {
    const response = await apiClient.post<
      BackendApiResponse<{ message: string }>
    >(`/scrape/brand/${brand}`);
    return response.data.data;
  },

  // Start scraping for all brands
  scrapeAll: async (): Promise<{ message: string }> => {
    const response =
      await apiClient.post<BackendApiResponse<{ message: string }>>(
        '/scrape/all'
      );
    return response.data.data;
  },
};