import { createAsyncThunk } from '@reduxjs/toolkit';
import axios from 'axios';
import { PizzaToCard, GetPizzaParams } from './types';

export const fetchPizzaToCard = createAsyncThunk<PizzaToCard[], GetPizzaParams>(
    'pizzaToCard/fetchPizzaToCardStatus',
    async (params) => {
        const { id } = params;
        const { data } = await axios.get<PizzaToCard[]>(`/api/loadingPizzaInformation/`+id);
        return data;
    },
  );