$npm i lodash
//movie.js 수정
import **_uniqBy** from 'lodash/uniqBy'
export default {
...
...
actions {
...
...
commit('updateState', {
movies: **_uniqBy**(Search, 'imdbID'),
})
...
if(pageLength > 1) {
for(let page = 2; page <= pageLength; page++) {
if(page > (number /10)) break
const res = await axios.get(`https://www.omdbapi.com/?apikey=${OMDB_API_KEY}&s=${title}&type=${type}&y=${year}&page=${page}`)
const { Search } = res.data
commit('updateState', {
movies: [
...state.movies,
...**_uniqBy**(Search, 'imdbID')]
})
}
}
}