mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
fixed calculation of empty fields on frontend
This commit is contained in:
parent
de7818c235
commit
c9d84a4947
3 changed files with 17 additions and 15 deletions
|
@ -48,13 +48,13 @@ const ProfileSettingsUnconnected: FC<IProps> = ({
|
||||||
event => {
|
event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
const fields = reject(el => !el)({
|
const fields = reject(el => typeof el === 'undefined')({
|
||||||
email: data.email !== user.email && data.email,
|
email: data.email !== user.email && data.email ? data.email : undefined,
|
||||||
fullname: data.fullname !== user.fullname && data.fullname,
|
fullname: data.fullname !== user.fullname ? data.fullname : undefined,
|
||||||
username: data.username !== user.username && data.username,
|
username: data.username !== user.username && data.username ? data.username : undefined,
|
||||||
password: password.length > 0 && password,
|
password: password.length > 0 && password ? password : undefined,
|
||||||
new_password: new_password.length > 0 && new_password,
|
new_password: new_password.length > 0 && new_password ? new_password : undefined,
|
||||||
description: data.description !== user.description && data.description,
|
description: data.description !== user.description ? data.description : undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Object.values(fields).length === 0) return;
|
if (Object.values(fields).length === 0) return;
|
||||||
|
|
|
@ -37,6 +37,7 @@ export const ERRORS = {
|
||||||
CANT_SAVE_COMMENT: 'CantSaveComment',
|
CANT_SAVE_COMMENT: 'CantSaveComment',
|
||||||
CANT_SAVE_NODE: 'CantSaveNode',
|
CANT_SAVE_NODE: 'CantSaveNode',
|
||||||
INPUT_TOO_SHIRT: 'InputTooShirt',
|
INPUT_TOO_SHIRT: 'InputTooShirt',
|
||||||
|
CANT_SAVE_USER: 'CantSaveUser',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ERROR_LITERAL = {
|
export const ERROR_LITERAL = {
|
||||||
|
@ -79,4 +80,5 @@ export const ERROR_LITERAL = {
|
||||||
[ERRORS.CANT_SAVE_COMMENT]: 'Не удалось сохранить коммент',
|
[ERRORS.CANT_SAVE_COMMENT]: 'Не удалось сохранить коммент',
|
||||||
[ERRORS.CANT_SAVE_NODE]: 'Не удалось сохранить пост',
|
[ERRORS.CANT_SAVE_NODE]: 'Не удалось сохранить пост',
|
||||||
[ERRORS.INPUT_TOO_SHIRT]: 'Должно быть длиннее',
|
[ERRORS.INPUT_TOO_SHIRT]: 'Должно быть длиннее',
|
||||||
|
[ERRORS.CANT_SAVE_USER]: 'Не удалось сохранить пользователя',
|
||||||
};
|
};
|
||||||
|
|
|
@ -508,14 +508,14 @@ function* authRegisterSocial({ username, password }: ReturnType<typeof authSendR
|
||||||
selectAuthRegisterSocial
|
selectAuthRegisterSocial
|
||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const { data, error }: Unwrap<ReturnType<typeof apiLoginWithSocial>> = yield call(
|
||||||
data,
|
apiLoginWithSocial,
|
||||||
error,
|
{
|
||||||
}: Unwrap<ReturnType<typeof apiLoginWithSocial>> = yield call(apiLoginWithSocial, {
|
|
||||||
token,
|
token,
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (data?.errors) {
|
if (data?.errors) {
|
||||||
yield put(authSetRegisterSocialErrors(data.errors));
|
yield put(authSetRegisterSocialErrors(data.errors));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue