|
|
@@ -241,7 +241,7 @@ class ChargeStationService {
|
|
|
return response.data.data.map((station: any) => {
|
|
|
// const snapshotData = JSON.parse(station.snapshot);
|
|
|
const snapshotData = station.snapshot;
|
|
|
-
|
|
|
+
|
|
|
const availableConnectors = station.Equipments.reduce((count: number, equipment: any) => {
|
|
|
return (
|
|
|
count +
|
|
|
@@ -356,6 +356,35 @@ class ChargeStationService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ async noImagefetchChargeStationIdByScannedConnectorId(scannedConnectorId: string) {
|
|
|
+ try {
|
|
|
+ const response = await axios.get(`${this.apiUrl}/clients/chargestations/resources/local/simple/info`, {
|
|
|
+ headers: {
|
|
|
+ Authorization: `Bearer ${await SecureStore.getItemAsync('accessToken')}`
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (response.status === 200 || response.status === 201) {
|
|
|
+ const station = response.data.data.find((station: any) =>
|
|
|
+ station.Equipments.some((equipment: any) =>
|
|
|
+ equipment.ConnectorInfos.some((connector: any) => connector.ConnectorID === scannedConnectorId)
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
+ return station?.id;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ if (axios.isAxiosError(error)) {
|
|
|
+ console.error('Login error:', error.response?.data?.message || error.message);
|
|
|
+ } else {
|
|
|
+ console.error('An unexpected error occurred:', error);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
async fetchAllChargeStations() {
|
|
|
try {
|
|
|
const response = await axios.get(`${this.apiUrl}/clients/chargestations/resources/info`, {
|