fix(title): fix site crash

production status of titles is sometimes null. this commit accounts for that and prevents site from crashing.

https://github.com/zyachel/libremdb/issues/22
This commit is contained in:
zyachel 2022-12-01 22:29:28 +05:30
parent 28d8331ae9
commit dd75df01eb
3 changed files with 8 additions and 6 deletions

View file

@ -58,7 +58,7 @@ const Basic = ({ data, className }: Props) => {
{data.title}
</h1>
<ul className={styles.meta} aria-label="quick facts">
{data.status.id !== 'released' && (
{data.status && data.status.id !== 'released' && (
<li className={styles.meta__text}>{data.status.text}</li>
)}
<li className={styles.meta__text}>{data.type.name}</li>

View file

@ -18,7 +18,7 @@ export default interface RawTitle {
restrictionReason: Array<string>;
unrestrictedTotal: number;
};
};
} | null;
canHaveEpisodes: boolean;
series?: {
episodeNumber: {

View file

@ -25,10 +25,12 @@ const cleanTitle = (rawData: RawTitle) => {
| 'videoGame',
name: main.titleType.text,
},
status: {
id: main.productionStatus.currentProductionStage.id,
text: main.productionStatus.currentProductionStage.text,
},
...(main.productionStatus && {
status: {
id: main.productionStatus.currentProductionStage.id,
text: main.productionStatus.currentProductionStage.text,
},
}),
ceritficate: main.certificate?.rating || null,
...(main.releaseYear && {
releaseYear: {