fixed #24
All checks were successful
CSGOWTF/csgowtf/pipeline/head This commit looks good

This commit is contained in:
2021-10-26 06:56:43 +02:00
committed by Giovanni Harting
parent 84617a1d57
commit c346dd13e8
2 changed files with 7 additions and 7 deletions

View File

@@ -2,22 +2,22 @@ export const SaveLastVisitedToLocalStorage = (data) => {
let a = JSON.parse(localStorage.getItem('recent-visited')) || [];
if (a.length === 0) {
a.push(data);
a.unshift(data);
} else if (a.length === 9) {
if (a.find(p => p.steamid64 === data.steamid64)) {
a.shift()
a.splice(a.findIndex(i => i.steamid64 === data.steamid64), 1)
a.push(data)
a.unshift(data)
} else if (!a.find(p => p.steamid64 === data.steamid64)) {
a.shift()
a.push(data)
a.unshift(data)
}
} else if (a.length > 0 && a.length < 9) {
if (a.find(p => p.steamid64 === data.steamid64)) {
a.splice(a.findIndex(i => i.steamid64 === data.steamid64), 1)
a.push(data)
a.unshift(data)
} else if (!a.find(p => p.steamid64 === data.steamid64)) {
a.push(data)
a.unshift(data)
}
}

View File

@@ -55,7 +55,6 @@ export default {
recentVisited.value = JSON.parse(localStorage.getItem('recent-visited'))
if (recentVisited.value !== null) {
recentVisited.value.reverse()
if (window.innerWidth < 768) {
recentVisited.value = recentVisited.value.filter(i => recentVisited.value.indexOf(i) < 6)
}
@@ -65,6 +64,7 @@ export default {
const removeRecentVisited = (key) => {
if (recentVisited.value !== null) {
recentVisited.value.splice(key, 1)
recentVisited.value.reverse()
localStorage.clear()