mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-01 21:13:39 +01:00
Fix: handle ghostfolio v2.79.0 breaking API changes (#3471)
This commit is contained in:
parent
d20ab844d6
commit
43ebd6d0c5
@ -5,8 +5,12 @@ import Block from "components/services/widget/block";
|
|||||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||||
|
|
||||||
function getPerformancePercent(t, performanceRange) {
|
function getPerformancePercent(t, performanceRange) {
|
||||||
return `${performanceRange.performance.currentGrossPerformancePercent > 0 ? "+" : ""}${t("common.percent", {
|
// ghostfolio v2.79.0 changed to grossPerformancePercentage
|
||||||
value: performanceRange.performance.currentGrossPerformancePercent * 100,
|
const percent =
|
||||||
|
performanceRange.performance.grossPerformancePercentage ??
|
||||||
|
performanceRange.performance.currentGrossPerformancePercent;
|
||||||
|
return `${percent > 0 ? "+" : ""}${t("common.percent", {
|
||||||
|
value: percent * 100,
|
||||||
maximumFractionDigits: 2,
|
maximumFractionDigits: 2,
|
||||||
})}`;
|
})}`;
|
||||||
}
|
}
|
||||||
@ -24,6 +28,10 @@ export default function Component({ service }) {
|
|||||||
return <Container service={service} error={finalError} />;
|
return <Container service={service} error={finalError} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (performanceToday?.statusCode === 401) {
|
||||||
|
return <Container service={service} error={performanceToday} />;
|
||||||
|
}
|
||||||
|
|
||||||
if (!performanceToday || !performanceYear || !performanceMax) {
|
if (!performanceToday || !performanceYear || !performanceMax) {
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user