Fix api exception error

This commit is contained in:
philipp lang 2022-04-28 23:27:25 +02:00
parent a2427fa19d
commit 1ebb229fbc
1 changed files with 6 additions and 7 deletions

View File

@ -121,17 +121,16 @@ class Api
if (data_get($attributes, 'id')) {
$payload = array_merge($existing, $member->toNami());
$payload['kontoverbindung'] = json_encode(data_get($payload, 'kontoverbindung', []));
$response = $this->http()->put(
$this->url.'/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/'.$member->group_id.'/'.$member->id,
$payload
);
$url = $this->url.'/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/'.$member->group_id.'/'.$member->id;
$response = $this->http()->put($url, $payload);
if (true !== data_get($response->json(), 'success')) {
$this->exception('Update failed', $member->toNami(), $response->json());
$this->exception('Update failed', $url, $response->json(), $member->toNami());
}
} else {
$response = $this->http()->post($this->url.'/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/'.$member->group_id, $member->toNami());
$url = $this->url.'/ica/rest/nami/mitglied/filtered-for-navigation/gruppierung/gruppierung/'.$member->group_id;
$response = $this->http()->post($url, $member->toNami());
if (true !== data_get($response->json(), 'success')) {
$this->exception('Update failed', $member->toNami(), $response->json());
$this->exception('Update failed', $url, $response->json(), $member->toNami());
}
return ['id' => $response->json()['data']];