forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
e33d448055
commit
d2134668b1
25 changed files with 109 additions and 171 deletions
|
@ -16,15 +16,23 @@ export default class PlantNet {
|
|||
url += "&images=" + encodeURIComponent(image)
|
||||
}
|
||||
|
||||
const result = await Utils.downloadJsonCachedAdvanced(url, 365 * 24 * 60 * 60 * 1000, undefined, true, 1)
|
||||
const result = await Utils.downloadJsonCachedAdvanced(
|
||||
url,
|
||||
365 * 24 * 60 * 60 * 1000,
|
||||
undefined,
|
||||
true,
|
||||
1
|
||||
)
|
||||
if (result["content"]) {
|
||||
return result["content"]
|
||||
}
|
||||
const errResult = <{
|
||||
"statusCode": 404,
|
||||
"error": "Not Found",
|
||||
"message": "Species not found" | string
|
||||
}>JSON.parse(result["errContent"])
|
||||
const errResult = <
|
||||
{
|
||||
statusCode: 404
|
||||
error: "Not Found"
|
||||
message: "Species not found" | string
|
||||
}
|
||||
>JSON.parse(result["errContent"])
|
||||
if (errResult.message === "Species not found") {
|
||||
return "no_plant_detected"
|
||||
}
|
||||
|
@ -32,7 +40,6 @@ export default class PlantNet {
|
|||
console.log("Get error result:", err, ">>>>", result["errContent"])
|
||||
throw err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface PlantNetSpeciesMatch {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue