File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -74,22 +74,30 @@ export const updateNews = async (
74
74
streetLocation : IStreetData | null ,
75
75
gpsLocation : IGpsData | null
76
76
) : Promise < any > => {
77
- const payload : any = {
77
+ // Construct query params
78
+ const queryParams : any = {
78
79
newsflash_location_qualification : newLocationQualification ,
79
80
} ;
80
81
81
82
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 ;
84
85
} 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 ;
87
88
}
88
89
89
90
const url = `${ NEWS_FLASH_API } /${ newsId } ` ;
90
91
91
92
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
+ ) ;
93
101
return response . data ;
94
102
} catch ( error ) {
95
103
console . error ( 'Error updating newsflash:' , error ) ;
You can’t perform that action at this time.
0 commit comments