mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-08-14 23:57:27 +00:00
Small improvements to code.
This commit is contained in:
parent
f18388c828
commit
ef8dbb9074
2 changed files with 5 additions and 9 deletions
|
@ -87,12 +87,7 @@ export default {
|
|||
},
|
||||
getUnauthenticatedChannels() {
|
||||
const localSubscriptions = this.getLocalSubscriptions();
|
||||
var channels = "";
|
||||
localSubscriptions.forEach((element, index) => {
|
||||
channels += element;
|
||||
if (localSubscriptions.size != index) channels += ",";
|
||||
});
|
||||
return channels;
|
||||
return localSubscriptions.join(",");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -208,11 +208,12 @@ const mixin = {
|
|||
return localSubscriptions.includes(channelId);
|
||||
},
|
||||
handleLocalSubscriptions(channelId) {
|
||||
var localSubscriptions = this.getLocalSubscriptions();
|
||||
if (localSubscriptions == null || localSubscriptions.size == 0) localSubscriptions = [channelId];
|
||||
else if (localSubscriptions.includes(channelId))
|
||||
var localSubscriptions = this.getLocalSubscriptions() ?? [];
|
||||
if (localSubscriptions.includes(channelId))
|
||||
localSubscriptions.splice(localSubscriptions.indexOf(channelId));
|
||||
else localSubscriptions.push(channelId);
|
||||
// Sort for better cache hits
|
||||
localSubscriptions.sort();
|
||||
localStorage.setItem("localSubscriptions", JSON.stringify(localSubscriptions));
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue