Skip to content

Commit aafec04

Browse files
committed
fix: use correct method, add typesafety & error handling
1 parent 33bd33d commit aafec04

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/gauge/Components/InterfaceSample.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,12 @@ export class InterfaceSample extends DisplayComponent<InterfaceSampleProps> {
160160
private async handleDownloadClick() {
161161
try {
162162
if (!this.navdataInterface.getIsInitialized()) throw new Error("Navdata interface not initialized")
163+
164+
const format = this.dropdownRef.instance.getNavigationDataFormat()
165+
if (!format) throw new Error("Unable to fetch package: No navigation data format has been selected")
163166

164167
// Get default package for client
165-
const pkg = await packages.getPackage(this.dropdownRef.instance.getNavdataFormat() as string)
166-
168+
const pkg = await packages.getPackage(format)
167169

168170
// Download navdata to work dir
169171
await this.navdataInterface.download_navdata(pkg.file.url, pkg.format)

0 commit comments

Comments
 (0)