Skip to content

Commit

Permalink
Verify if imported profiles from vehicle are indeed profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl committed Nov 16, 2023
1 parent a10df7e commit 9ce3199
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/stores/widgetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ export const useWidgetManagerStore = defineStore('widget-manager', () => {
vehicleStore.globalAddress,
'cockpit-saved-profiles-v7'
)
if (!Array.isArray(newProfiles) || !newProfiles.every((profile) => isProfile(profile))) {
Swal.fire({ icon: 'error', text: 'Could not import profiles from vehicle. Invalid data.', timer: 3000 })
return
}
savedProfiles.value = newProfiles
Swal.fire({ icon: 'success', text: 'Cockpit profiles imported from vehicle.', timer: 3000 })
}
Expand Down

0 comments on commit 9ce3199

Please sign in to comment.