From 36599b4f2bdc33794f568fd95af96a7724442036 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 8 Oct 2026 11:46:47 +1000 Subject: [PATCH] fix: add error message when downloads unavailable fix: change to new api endpoints --- src/components/docs/AIRSDKDownload.tsx | 29 +++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/components/docs/AIRSDKDownload.tsx b/src/components/docs/AIRSDKDownload.tsx index a112cc71b..53f5a8fe8 100644 --- a/src/components/docs/AIRSDKDownload.tsx +++ b/src/components/docs/AIRSDKDownload.tsx @@ -1,17 +1,18 @@ -import React, { useEffect, Component } from 'react'; +import React, { Component } from 'react'; import styles from './AIRSDKDownload.module.css'; import AIRSDKAcceptLicenseButton from './AIRSDKAcceptLicenseButton'; import DownloadButton from './DownloadButton'; class AIRSDKDownload extends Component<{ platform?: string }> { airAPIURL = - 'https://api.airsdk.harman.com/releases/latest/urls'; + 'https://api.airsdk.dev/releases/latest/urls'; - airDownloadURL = 'https://airsdk.harman.com'; + airDownloadURL = 'https://assets.airsdk.dev'; state = { loading: true, - airsdkurls: [], + airsdkurls: {} as Record, + error: false, acceptedLicense: false, }; @@ -21,17 +22,26 @@ class AIRSDKDownload extends Component<{ platform?: string }> { }; componentDidMount() { - this.state.acceptedLicense = sessionStorage.getItem('acceptedLicense') === 'true'; + this.setState({ + acceptedLicense: sessionStorage.getItem('acceptedLicense') === 'true', + }); fetch(this.airAPIURL) - .then((res) => res.json()) + .then((res) => { + if (!res.ok) { + throw new Error(`AIR SDK download request failed: ${res.status}`); + } + return res.json(); + }) .then((data) => { this.setState({ loading: false, airsdkurls: data, }); }) - .catch(console.log); + .catch(() => { + this.setState({ loading: false, error: true }); + }); } downloadURLForPlatform = (forFlex: boolean) => { @@ -62,6 +72,11 @@ class AIRSDKDownload extends Component<{ platform?: string }> {
{this.state.loading ? (
Loading ...
+ ) : this.state.error ? ( +
+ Download links are currently unavailable.{' '} + Download AIR SDK from HARMAN. +
) : (
{!acceptedLicense ? (