WIP Доделал форму Контактов
This commit is contained in:
@@ -245,19 +245,24 @@ const actions = {
|
||||
.filter((el) => !allNewContacts.find((newNet) => newNet.id === el.id))
|
||||
.map((el) => fetchWrapper.del(`general/contact/${el.id}/delete/`));
|
||||
const request = allNewContacts
|
||||
.map((network) => {
|
||||
let initNetwork = initContacts.find((el) => el.id === network.id);
|
||||
if (!network.id) {
|
||||
.map((contact) => {
|
||||
let initNetwork = initContacts.find((el) => el.id === contact.id);
|
||||
if (!contact.id && contact.username && contact.kind) {
|
||||
return fetchWrapper.post(`general/contact/create/`, {
|
||||
person: personId,
|
||||
...network,
|
||||
username: contact.username,
|
||||
kind: contact.kind,
|
||||
});
|
||||
}
|
||||
if (network.id && network.username !== initNetwork.username) {
|
||||
return fetchWrapper.post(`general/contact/${network.id}/update/`, {
|
||||
if (
|
||||
contact.id &&
|
||||
contact.username &&
|
||||
contact.username !== initNetwork.username
|
||||
) {
|
||||
return fetchWrapper.post(`general/contact/${contact.id}/update/`, {
|
||||
person: personId,
|
||||
username: network.username,
|
||||
kind: network.kind,
|
||||
username: contact.username,
|
||||
kind: contact.kind,
|
||||
});
|
||||
}
|
||||
return Promise.resolve();
|
||||
|
||||
Reference in New Issue
Block a user