Files
mixtape/zero.Backoffice.UI/app/modules/users/api.ts
T

26 lines
1.2 KiB
TypeScript

import { get, post, put, del, ApiRequestConfig, ApiRequestQuery } from '../../services/request';
export default {
getEmpty: (flavor?: string, config?: ApiRequestConfig) => get("users/empty", { ...config, params: { flavor } }),
getById: (id: string, changeVector?: string, config?: ApiRequestConfig) => get('users/' + id, { ...config, params: { changeVector } }),
getByQuery: (query: ApiRequestQuery, config?: ApiRequestConfig) => get('users', { ...config, params: { ...query } }),
create: (model: any, config?: ApiRequestConfig) => post('users', model, config),
update: (model: any, config?: ApiRequestConfig) => put('users/' + model.id, model, config),
delete: (id: string, config?: ApiRequestConfig) => del('users/' + id, null, config),
getRandomPassword: (length?: number, config?: ApiRequestConfig) => get("users/password/random" + (length ? '/' + length : ''), { ...config }),
//updatePassword: async model => await post(base + 'updatePassword', model),
//hashPassword: async model => await post(base + 'hashPassword', model),
//disable: async model => await post(base + 'disable', model),
//enable: async model => await post(base + 'enable', model)
};