* CEC-2056 safari map (#186) * CEC-2056 Fix Safari map popup * Snapshot serializer for Private styles * Combine serializers * CEC-2207 Add is-online filter for vehicles list (#187) * Add OptionsDropdown component * Add is-online filter * CEC-2237 Track sign in and keys (#188) * Update stage (#189) * CEC-2056 safari map (#186) * CEC-2056 Fix Safari map popup * Snapshot serializer for Private styles * Combine serializers * CEC-2207 Add is-online filter for vehicles list (#187) * Add OptionsDropdown component * Add is-online filter * CEC-2237 Track sign in and keys (#188) Co-authored-by: arpanetus <arpanetus@protonmail.com> * CEC-2281 Update certificate form (#190) * CEC-2281 Fix cert name * CEC-2360 Fix filename display and add manifest type (#191) * CEC-2360 Fix filename display and add manifest type * const * Push to Stage (#200) * CEC-2144, CEC-2338 Add deploy by fleets and fix fleets table (#192) * Add fix for fleets search * Decompose fleets table * Add deploy by fleets * Add snapshots * CEC-2385 Only show software updates (#193) * CEC-2385 Only show software updates * Update browser list * update threshold * Clean up * CEC-2291 Remote Commands (#194) * CEC-2378 Add fix for fleet vehicles' search * CEC-1235 Fix fleet name update (#196) Co-authored-by: arpanetus <arpanetus@protonmail.com> Co-authored-by: arpanetus <arpanetus@protonmail.com>
82 lines
2.1 KiB
JavaScript
82 lines
2.1 KiB
JavaScript
import {
|
|
errorHandler,
|
|
getAuthHeaderOptions,
|
|
fetchRespHandler,
|
|
addQueryParams,
|
|
} from "../utils/http";
|
|
|
|
const API_ENDPOINT = process.env.REACT_APP_UPLOAD_SERVICE_URL;
|
|
|
|
const createDeployUpdatesClosure = (suffix) => {
|
|
return async (data, token) => fetch(`${API_ENDPOINT}/${suffix}`, {
|
|
method: "POST",
|
|
headers: Object.assign(
|
|
{ "Content-Type": "application/json" },
|
|
getAuthHeaderOptions(token)
|
|
),
|
|
body: JSON.stringify(data),
|
|
})
|
|
.then(fetchRespHandler)
|
|
.catch(errorHandler)
|
|
}
|
|
|
|
const updatesAPI = {
|
|
createFleetUpdates: createDeployUpdatesClosure("fleetupdate"),
|
|
|
|
createCarUpdates: createDeployUpdatesClosure("carupdate"),
|
|
|
|
getCarUpdateLog: async (query, token) => {
|
|
const u = addQueryParams(`${API_ENDPOINT}/carupdateslog`, query);
|
|
return fetch(u, {
|
|
method: "GET",
|
|
headers: Object.assign(
|
|
{ "Content-Type": "application/json" },
|
|
getAuthHeaderOptions(token)
|
|
),
|
|
})
|
|
.then(fetchRespHandler)
|
|
.catch(errorHandler);
|
|
},
|
|
|
|
getCarUpdateProgress: async (carupdateids, token) => {
|
|
const u = `${API_ENDPOINT}/carupdatesstatuses?carupdateids=${carupdateids}`;
|
|
return fetch(u, {
|
|
method: "GET",
|
|
headers: Object.assign(
|
|
{ "Content-Type": "application/json" },
|
|
getAuthHeaderOptions(token)
|
|
),
|
|
})
|
|
.then(fetchRespHandler)
|
|
.catch(errorHandler);
|
|
},
|
|
|
|
getCarUpdates: async (search, token) => {
|
|
const u = addQueryParams(`${API_ENDPOINT}/carupdates`, search);
|
|
return fetch(u, {
|
|
method: "GET",
|
|
headers: Object.assign(
|
|
{ "Content-Type": "application/json" },
|
|
getAuthHeaderOptions(token)
|
|
),
|
|
})
|
|
.then(fetchRespHandler)
|
|
.catch(errorHandler);
|
|
},
|
|
|
|
getVINUpdates: async (vin, token) => {
|
|
const u = addQueryParams(`${API_ENDPOINT}/carupdates`, { vin });
|
|
return fetch(u, {
|
|
method: "GET",
|
|
headers: Object.assign(
|
|
{ "Content-Type": "application/json" },
|
|
getAuthHeaderOptions(token)
|
|
),
|
|
})
|
|
.then(fetchRespHandler)
|
|
.catch(errorHandler);
|
|
},
|
|
};
|
|
|
|
export default updatesAPI;
|