Skip to content

Commit 32df185

Browse files
authored
Merge pull request #1203 from data-for-change/dev
merge dev into master
2 parents 5670295 + 41f8732 commit 32df185

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/services/news.data.service.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,30 @@ export const updateNews = async (
7474
streetLocation: IStreetData | null,
7575
gpsLocation: IGpsData | null
7676
): Promise<any> => {
77-
const payload: any = {
77+
// Construct query params
78+
const queryParams: any = {
7879
newsflash_location_qualification: newLocationQualification,
7980
};
8081

8182
if (gpsLocation) {
82-
payload.road_segment_id = gpsLocation.road_segment_id;
83-
payload.road1 = gpsLocation.road1;
83+
queryParams.road_segment_id = gpsLocation.road_segment_id;
84+
queryParams.road1 = gpsLocation.road1;
8485
} else if (streetLocation) {
85-
payload.yishuv_name = streetLocation.city.yishuv_name;
86-
payload.street1_hebrew = streetLocation.street.street_hebrew;
86+
queryParams.yishuv_name = streetLocation.city.yishuv_name;
87+
queryParams.street1_hebrew = streetLocation.street.street_hebrew;
8788
}
8889

8990
const url = `${NEWS_FLASH_API}/${newsId}`;
9091

9192
try {
92-
const response = await axios.patch(url, payload, { withCredentials: true });
93+
const response = await axios.patch(
94+
url,
95+
{},
96+
{
97+
params: queryParams,
98+
withCredentials: true,
99+
}
100+
);
93101
return response.data;
94102
} catch (error) {
95103
console.error('Error updating newsflash:', error);

0 commit comments

Comments
 (0)