mirror of
https://github.com/Nezumi-2711/react-training.git
synced 2026-09-22 13:38:51 +00:00
Implement edit, delete user
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { INVALID_FORMAT_MSG } from '../constants/messages';
|
||||
import { TKeyValue, TPropValues, TStateSchema } from '../globals/types';
|
||||
import { TKeyValue, TPropValues, TStateSchema, TUser } from '../globals/types';
|
||||
|
||||
const VALUE = 'value';
|
||||
const ERROR = 'error';
|
||||
@@ -44,10 +44,19 @@ const addValidator = ({ validatorFunc, prop, required = true }: TValidator) => {
|
||||
};
|
||||
};
|
||||
|
||||
const getValueUser = (user: TUser | null = null, prop: string): string => {
|
||||
if (user) {
|
||||
return user[prop as keyof TUser];
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
export {
|
||||
isObject,
|
||||
isRequired,
|
||||
getPropValues,
|
||||
getValueUser,
|
||||
addValidator,
|
||||
VALUE,
|
||||
ERROR,
|
||||
|
||||
Reference in New Issue
Block a user