mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-06 19:45:24 +00:00
fix crach if localStorage is undefined
This commit is contained in:
parent
b537b0edd2
commit
e9aa16434b
@ -17,9 +17,11 @@ const storeSearchResults = () => {
|
||||
|
||||
const retrieveSearchResults = () => {
|
||||
const storedResults = localStorage.getItem('searchResults')
|
||||
if (storedResults) {
|
||||
try {
|
||||
if (!storedResults) return
|
||||
searchResults.value = JSON.parse(storedResults)
|
||||
selectedOption.value = localStorage.getItem('selectedOption') || 'film'
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +31,7 @@ retrieveSearchResults()
|
||||
|
||||
function searchTitle() {
|
||||
search(searchedTitle.value, selectedOption.value).then((res) => {
|
||||
searchResults.value = res.media
|
||||
searchResults.value = res.data.media
|
||||
}).catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user