@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.
- package/.env +1 -0
- package/CHANGELOG.md +2 -0
- package/build/main.js +1 -1
- package/build/test/parameters.json +1 -1
- package/build.zip +0 -0
- package/package.json +1 -1
- package/src/App.tsx +1 -1
- package/src/parameters.d.ts +0 -1
- package/src/services/index.ts +6 -2
- package/src/test/parameters.json +1 -1
package/build.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
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 || "
|
|
17
|
+
const cityInput = parameters?.cityInput || "Santiago"
|
|
18
18
|
const msj0 = parameters?.msj0 || 'No hay datos para mostrar'
|
|
19
19
|
const updateTime = 600000
|
|
20
20
|
|
package/src/parameters.d.ts
CHANGED
package/src/services/index.ts
CHANGED
|
@@ -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
|
-
|
|
72
|
-
|
|
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
|