Null List Error Fix (+Favourite Page Name)

Tests
Louison PARANT 2 years ago
parent 15e4b2467e
commit ada566c25c

@ -48,7 +48,7 @@ export default function MovieFinderScreenList(props : Props){
<SafeAreaView style={styles.container}>
<View style={styles.titlePage}>
<FontAwesomeIcon icon={props.page=="Favorite"?faHeart:faClock} style={styles.icon} size={40} color="white"/>
<Text style={styles.h1}>Watch Later</Text>
{props.page=="Favorite"?<Text style={styles.h1}>Favourite</Text>:<Text style={styles.h1}>Watch Later</Text>}
</View>
<Image source={require('../assets/images/delimiter.png')} style={styles.delimiter}/>
{props.children}

@ -5,9 +5,9 @@ export const getFavouriteList = async () => {
try {
const value = await AsyncStorage.getItem('favourite');
if (value === null) {
return null
return []
}
const favouriteList: Movie[] = await JSON.parse(value!)
const favouriteList: Movie[] = await JSON.parse(value)
return favouriteList
} catch (error) {
console.log(error)
@ -27,9 +27,9 @@ export const getWatchLaterList = async () => {
try {
const value = await AsyncStorage.getItem('watchLater')
if (value === null) {
return null
return []
}
const watchLaterList: Movie[] = await JSON.parse(value!)
const watchLaterList: Movie[] = await JSON.parse(value)
return watchLaterList
} catch (error) {
console.log(error)
@ -49,9 +49,9 @@ export const getMovieList = async () => {
try {
const value = await AsyncStorage.getItem('movie')
if (value === null) {
return null
return []
}
const movieList: Movie[] = await JSON.parse(value!)
const movieList: Movie[] = await JSON.parse(value)
return movieList
} catch (error) {
console.log(error)

Loading…
Cancel
Save