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:
parent
28d8331ae9
commit
dd75df01eb
3 changed files with 8 additions and 6 deletions
|
@ -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>
|
||||
|
|
|
@ -18,7 +18,7 @@ export default interface RawTitle {
|
|||
restrictionReason: Array<string>;
|
||||
unrestrictedTotal: number;
|
||||
};
|
||||
};
|
||||
} | null;
|
||||
canHaveEpisodes: boolean;
|
||||
series?: {
|
||||
episodeNumber: {
|
||||
|
|
|
@ -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: {
|
||||
|
|
Loading…
Reference in a new issue