X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=ui%2Fweb%2Fsrc%2Fcomposables%2FUIClient.ts;h=571d6d5b85a64cd4bb54ef2493c0af68d5e2b0bb;hb=385c5e62929a2c113898706b8ec940840b7f6f4f;hp=fcbf191f3c9d2dabfc6fa6354359d703eb67e28b;hpb=276e05aec38f4e8b4a8d5ebd8cbbcb30592b414d;p=e-mobility-charging-stations-simulator.git diff --git a/ui/web/src/composables/UIClient.ts b/ui/web/src/composables/UIClient.ts index fcbf191f..571d6d5b 100644 --- a/ui/web/src/composables/UIClient.ts +++ b/ui/web/src/composables/UIClient.ts @@ -12,7 +12,7 @@ import { type UIServerConfigurationSection } from '@/types' -import { randomUUID } from './Utils' +import { randomUUID, validateUUID } from './Utils' type ResponseHandler = { procedureName: ProcedureName @@ -240,8 +240,8 @@ export class UIClient { try { response = JSON.parse(messageEvent.data) as ProtocolResponse } catch (error) { - useToast().error('Invalid response format') - console.error('Invalid response format', error) + useToast().error('Invalid response JSON format') + console.error('Invalid response JSON format', error) return } @@ -253,7 +253,11 @@ export class UIClient { const [uuid, responsePayload] = response - console.log('responsePayload', responsePayload.state?.templateStatistics) + if (!validateUUID(uuid)) { + useToast().error('Response UUID field is invalid') + console.error('Response UUID field is invalid:', response) + return + } if (this.responseHandlers.has(uuid)) { const { procedureName, resolve, reject } = this.responseHandlers.get(uuid)!