Advertisement
xcage88

action

May 21st, 2023
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { createAsyncThunk } from "@reduxjs/toolkit";
  2. import { httpService } from "../../utils/serviceApi";
  3.  
  4. export const fetchAll = createAsyncThunk('bootcamp/fetchAllBootcamp', async() => {
  5.     try {
  6.         const respone = await httpService.get('/')
  7.         return respone.data
  8.     } catch (error) {
  9.         throw error
  10.     }
  11. })
  12.  
  13. export const fetchProduct = createAsyncThunk('bootcamp/fetchProductBootcamp', async(bootcampId) => {
  14.     try {
  15.         console.log('respone', bootcampId)
  16.         const respone = await httpService.get(`/${bootcampId}`)
  17.         return respone.data
  18.     } catch (error) {
  19.         throw error
  20.     }
  21. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement