// groupRepository.ts

// @ts-ignore
import Repository from './Repository';
import Vue from 'vue/types/vue';
import axios from 'axios';
import {dictEmptyValToNull} from '@/utils';

const resource = '/user';

export default {
  getUsers() {
    return Repository.get(`${resource}`);
  },

  getUser(userId: number) {
    return Repository.get(`${resource}/${userId}`);
  },

  createUser(userData: any) {
    return Repository.post(`${resource}`, userData);
  },

  getProfile() {
    return Repository.get(`${resource}/profile`);
  },
  updateProfile(userData: any) {
    return Repository.put(`${resource}/profile`, dictEmptyValToNull(userData));
  },
  getFavoriteRecorders() {
    return Repository.get(`${resource}/profile/favorite_recorders`);
  },

  addFavoriteRecorder(recorderId: any) {
    return Repository.put(`${resource}/profile/favorite_recorders`, {id: recorderId});
  },
};
