@@ -51,31 +51,31 @@ export class OMDbAPI extends APIModel {
51
51
let ret : MediaTypeModel [ ] = [ ] ;
52
52
53
53
for ( const result of data . Search ) {
54
- const type = this . typeMappings . get ( result . type . toLowerCase ( ) ) ;
54
+ const type = this . typeMappings . get ( result . Type . toLowerCase ( ) ) ;
55
55
if ( type === undefined ) {
56
56
continue ;
57
57
}
58
- if ( result . Type === 'movie' ) {
58
+ if ( type === 'movie' ) {
59
59
ret . push ( new MovieModel ( {
60
- type : 'movie' ,
60
+ type : type ,
61
61
title : result . Title ,
62
62
englishTitle : result . Title ,
63
63
year : result . Year ,
64
64
dataSource : this . apiName ,
65
65
id : result . imdbID ,
66
66
} as MovieModel ) ) ;
67
- } else if ( result . Type === 'series' ) {
67
+ } else if ( type === 'series' ) {
68
68
ret . push ( new SeriesModel ( {
69
- type : 'series' ,
69
+ type : type ,
70
70
title : result . Title ,
71
71
englishTitle : result . Title ,
72
72
year : result . Year ,
73
73
dataSource : this . apiName ,
74
74
id : result . imdbID ,
75
75
} as SeriesModel ) ) ;
76
- } else if ( result . Type === 'game' ) {
76
+ } else if ( type === 'game' ) {
77
77
ret . push ( new GameModel ( {
78
- type : 'game' ,
78
+ type : type ,
79
79
title : result . Title ,
80
80
englishTitle : result . Title ,
81
81
year : result . Year ,
@@ -108,7 +108,7 @@ export class OMDbAPI extends APIModel {
108
108
throw Error ( `Received error from ${ this . apiName } : ${ result . Error } ` ) ;
109
109
}
110
110
111
- const type = this . typeMappings . get ( result . type . toLowerCase ( ) ) ;
111
+ const type = this . typeMappings . get ( result . Type . toLowerCase ( ) ) ;
112
112
if ( type === undefined ) {
113
113
throw Error ( `${ result . type . toLowerCase ( ) } is an unsupported type.` ) ;
114
114
}
0 commit comments