Code Smell Corrections
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
2a5e43ded9
commit
ef5c4f1eb1
@ -1,47 +1,68 @@
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import Movie from "../model/Movie";
|
||||
import {useDispatch, useSelector} from "react-redux";
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage'
|
||||
import Movie from "../model/Movie"
|
||||
|
||||
export const getFavouriteList = async () => {
|
||||
try {
|
||||
const value = await AsyncStorage.getItem('favourite');
|
||||
if (value === null) {
|
||||
return [];
|
||||
return null
|
||||
}
|
||||
const favouriteList: Movie[] = await JSON.parse(value!)
|
||||
return favouriteList;
|
||||
return favouriteList
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
return [];
|
||||
return null
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const setFavouriteList = async (favouriteList: Movie[]) => {
|
||||
try {
|
||||
await AsyncStorage.setItem('favourite', JSON.stringify(favouriteList));
|
||||
await AsyncStorage.setItem('favourite', JSON.stringify(favouriteList))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const getWatchLaterList = async () => {
|
||||
try {
|
||||
const value = await AsyncStorage.getItem('watchLater');
|
||||
const value = await AsyncStorage.getItem('watchLater')
|
||||
if (value === null) {
|
||||
return [];
|
||||
return null
|
||||
}
|
||||
const watchLaterList: Movie[] = await JSON.parse(value!)
|
||||
return watchLaterList;
|
||||
return watchLaterList
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
return [];
|
||||
return null
|
||||
}
|
||||
};
|
||||
|
||||
export const setWatchLaterList = async (watchLaterList: Movie[]) => {
|
||||
try {
|
||||
await AsyncStorage.setItem('watchLater', JSON.stringify(watchLaterList));
|
||||
await AsyncStorage.setItem('watchLater', JSON.stringify(watchLaterList))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
export const getMovieList = async () => {
|
||||
try {
|
||||
const value = await AsyncStorage.getItem('movie')
|
||||
if (value === null) {
|
||||
return null
|
||||
}
|
||||
const movieList: Movie[] = await JSON.parse(value!)
|
||||
return movieList
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export const setMovieList = async (movieList: Movie[]) => {
|
||||
try {
|
||||
await AsyncStorage.setItem('movie', JSON.stringify(movieList))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Reference in new issue