-function startChargingStation(): void {
- UIClient.startChargingStation(getHashId())
-}
-function stopChargingStation(): void {
- UIClient.stopChargingStation(getHashId())
-}
-function openConnection(): void {
- UIClient.openConnection(getHashId())
-}
-function closeConnection(): void {
- UIClient.closeConnection(getHashId())
-}
-function deleteChargingStation(): void {
- UIClient.deleteChargingStation(getHashId())
+const $toast = useToast()
+
+const startChargingStation = (): void => {
+ uiClient
+ .startChargingStation(props.chargingStation.stationInfo.hashId)
+ .then(() => {
+ $toast.success('Charging station successfully started')
+ })
+ .catch((error: Error) => {
+ $toast.error('Error at starting charging station')
+ console.error('Error at starting charging station:', error)
+ })
+}
+const stopChargingStation = (): void => {
+ uiClient
+ .stopChargingStation(props.chargingStation.stationInfo.hashId)
+ .then(() => {
+ $toast.success('Charging station successfully stopped')
+ })
+ .catch((error: Error) => {
+ $toast.error('Error at stopping charging station')
+ console.error('Error at stopping charging station:', error)
+ })
+}
+const openConnection = (): void => {
+ uiClient
+ .openConnection(props.chargingStation.stationInfo.hashId)
+ .then(() => {
+ $toast.success('Connection successfully opened')
+ })
+ .catch((error: Error) => {
+ $toast.error('Error at opening connection')
+ console.error('Error at opening connection:', error)
+ })
+}
+const closeConnection = (): void => {
+ uiClient
+ .closeConnection(props.chargingStation.stationInfo.hashId)
+ .then(() => {
+ $toast.success('Connection successfully closed')
+ })
+ .catch((error: Error) => {
+ $toast.error('Error at closing connection')
+ console.error('Error at closing connection:', error)
+ })
+}
+const deleteChargingStation = (): void => {
+ uiClient
+ .deleteChargingStation(props.chargingStation.stationInfo.hashId)
+ .then(() => {
+ $toast.success('Charging station successfully deleted')
+ })
+ .catch((error: Error) => {
+ $toast.error('Error at deleting charging station')
+ console.error('Error at deleting charging station:', error)
+ })