/* eslint-disable import/no-unresolved */
/* eslint-disable import/order */


import { sageService } from '@/service/sageService';
import { Famille, FamilleRequest } from '@/types/familleType';
import { createAsyncThunk } from '@reduxjs/toolkit';


/**
 * get all familles
 */
export const getfamilles = createAsyncThunk(
  'famille/getFamilles',
  async (): Promise<Famille[]> => {
    try {
      return await sageService.getFamilles();
    } catch (err) {
      throw err;
    }
  }
);




/**
 * add famille
 */
export const createFamille = createAsyncThunk(
  'famille/createFamille',
  async (data: FamilleRequest): Promise<Famille> => {
    try {
      return await sageService.createFamille(data);
    } catch (err) {
      throw err;
    }
  }
);
