@vixoniccom/aqi 0.0.3-dev.4 → 0.0.3-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  "filename": "Earthquakes.png",
6
6
  "__isAsset": true
7
7
  },
8
- "cityInput": "Santiago",
8
+ "cityInput": "Osorno",
9
9
  "topSeparationCard": 200,
10
10
  "leftSeparationCard": 600,
11
11
  "cardWidth": 700,
package/build.zip CHANGED
Binary file
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "author": {
9
9
  "name": "Daniel Alvayay"
10
10
  },
11
- "version": "0.0.3-dev.4",
11
+ "version": "0.0.3-dev.5",
12
12
  "scripts": {
13
13
  "prepublish": "vixonic-module-packager --mode=build",
14
14
  "watch": "vixonic-module-packager --mode=watch",
package/src/App.tsx CHANGED
@@ -14,7 +14,7 @@ export const App: React.FunctionComponent<Props> = ({ data, start }) => {
14
14
  const { parameters, downloadsPath } = data
15
15
  const backgroundImageState = parameters.backgroundImage ? `url('${downloadsPath}/${parameters.backgroundImage.filename}')` : ''
16
16
  const [formattedData, setFormattedData] = useState<AqiData>()
17
- const cityInput = parameters?.cityInput || "santiago"
17
+ const cityInput = parameters?.cityInput || "Santiago"
18
18
  const msj0 = parameters?.msj0 || 'No hay datos para mostrar'
19
19
  const updateTime = 600000
20
20
 
@@ -5,7 +5,6 @@ declare type VixonicData = {
5
5
  }
6
6
 
7
7
  declare type VixonicParameters = Partial<{
8
- services: {id: string }
9
8
  backgroundImage: { id?: string; filename?: string; extension?: string }
10
9
  topSeparationCard: number
11
10
  leftSeparationCard: number
@@ -68,8 +68,12 @@ export const getData = async (cityInput: string, updateTime: number, defaultMsg:
68
68
  console.log('[AQI] getData: cache MISS or stale → fetching from API')
69
69
  data = await requestData(cityInput)
70
70
  const processedData = processData(data, cityInput, defaultMsg)
71
- await localforage.setItem('aqi', { item: processedData, date: new Date() })
72
- console.log('[AQI] getData: saved to cache and returning:', processedData)
71
+ if (processedData.aqi !== undefined) {
72
+ await localforage.setItem('aqi', { item: processedData, date: new Date() })
73
+ console.log('[AQI] getData: saved to cache and returning:', processedData)
74
+ } else {
75
+ console.warn('[AQI] getData: data invalid (no aqi) → skipping cache save')
76
+ }
73
77
  return processedData
74
78
  } else {
75
79
  data = storageData.item
@@ -5,7 +5,7 @@
5
5
  "filename": "Earthquakes.png",
6
6
  "__isAsset": true
7
7
  },
8
- "cityInput": "Santiago",
8
+ "cityInput": "Osorno",
9
9
  "topSeparationCard": 200,
10
10
  "leftSeparationCard": 600,
11
11
  "cardWidth": 700,