Fix some bugs and small improvements.

This commit is contained in:
Kavin 2022-08-01 19:43:19 +05:30
parent 8e07948e28
commit ea49201eb9
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
3 changed files with 11 additions and 8 deletions

View file

@ -149,8 +149,17 @@ export default {
});
} else {
this.importSubscriptionsLocally(this.subscriptions);
window.location = "/feed";
}
},
importSubscriptionsLocally(newChannels) {
const subscriptions = this.override
? [...new Set(newChannels)]
: [...new Set(this.getLocalSubscriptions().concat(newChannels))];
// Sort for better cache hits
subscriptions.sort();
localStorage.setItem("localSubscriptions", JSON.stringify(subscriptions));
},
},
};
</script>

View file

@ -1,7 +1,7 @@
<template>
<h1 class="font-bold text-center my-4" v-t="'titles.subscriptions'" />
<div v-if="authenticated" class="flex justify-between w-full">
<div class="flex justify-between w-full">
<div class="flex">
<button class="btn mx-1">
<router-link to="/import" v-t="'actions.import_from_json'" />
@ -57,7 +57,7 @@ export default {
},
});
} else {
return await this.fetchJson(this.authApiUrl() + "/subscriptions/unauthenticated", null, {
return await this.fetchJson(this.authApiUrl() + "/subscriptions/unauthenticated", {
channels: this.getUnauthenticatedChannels(),
});
}

View file

@ -220,12 +220,6 @@ const mixin = {
const localSubscriptions = this.getLocalSubscriptions();
return localSubscriptions.join(",");
},
importSubscriptionsLocally(newChannels) {
const subscriptions = this.getLocalSubscriptions().concat(newChannels);
// Sort for better cache hits
subscriptions.sort();
localStorage.setItem("localSubscriptions"), JSON.stringify(subscriptions);
},
},
computed: {
theme() {