import {
  DATA_URL,
  PROCEDURES,
} from 'config'
import { callApi } from 'helpers'

import type { UserPreferences } from './getUserPreferences'

const proc = PROCEDURES.save_user_preferences

export const saveUserPreferences = (data: UserPreferences | null) => {
  const config = {
    body: {
      params: {
        _p_data: data,
      },
      proc,
    },
  }

  return callApi({
    config,
    url: DATA_URL,
  })
}
