Spaces:
Running
Running
Commit
·
ae604b6
1
Parent(s):
9d9fc6b
fix: models
Browse files
src/lib/models/fitness-model.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import { FitnessGoal } from "@common/enums/fitness-goal.enum";
|
| 2 |
import { FitnessLevel } from "@common/enums/fitness-level.enum";
|
| 3 |
import { Gender } from "@common/enums/gender.enum";
|
|
@@ -52,8 +53,9 @@ export class FitnessModel {
|
|
| 52 |
throw new Error("Failed to fetch data from the server");
|
| 53 |
}
|
| 54 |
|
| 55 |
-
return response.
|
| 56 |
-
|
|
|
|
| 57 |
});
|
| 58 |
}
|
| 59 |
}
|
|
|
|
| 1 |
+
import { ExerciseType } from "@common/enums/exercise-type.enum";
|
| 2 |
import { FitnessGoal } from "@common/enums/fitness-goal.enum";
|
| 3 |
import { FitnessLevel } from "@common/enums/fitness-level.enum";
|
| 4 |
import { Gender } from "@common/enums/gender.enum";
|
|
|
|
| 53 |
throw new Error("Failed to fetch data from the server");
|
| 54 |
}
|
| 55 |
|
| 56 |
+
return response.text().then((data) => {
|
| 57 |
+
data = data.replace('NaN', ExerciseType.DURATION.toString()).replace('\n', '')
|
| 58 |
+
return JSON.parse(data)
|
| 59 |
});
|
| 60 |
}
|
| 61 |
}
|
src/lib/models/nutrition_model.ts
CHANGED
|
@@ -39,8 +39,8 @@ export class NutritionModel {
|
|
| 39 |
throw new Error("Failed to fetch data from the server");
|
| 40 |
}
|
| 41 |
|
| 42 |
-
return response.
|
| 43 |
-
return data
|
| 44 |
});
|
| 45 |
}
|
| 46 |
}
|
|
|
|
| 39 |
throw new Error("Failed to fetch data from the server");
|
| 40 |
}
|
| 41 |
|
| 42 |
+
return response.text().then((data) => {
|
| 43 |
+
return JSON.parse(data) as INutritionPredictionItem[][];
|
| 44 |
});
|
| 45 |
}
|
| 46 |
}
|