import React from 'react';

export const sorterColumnTable = (
  sorterData: { field: string; order: string },
  setSorterField: React.Dispatch<React.SetStateAction<string>>,
): void => {
  if (sorterData.order === 'ascend') {
    setSorterField(`&ordering=${sorterData.field}`);
  } else if (sorterData.order === 'descend') {
    setSorterField(`&ordering=-${sorterData.field}`);
  } else {
    setSorterField('');
  }
};
