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 { } else {
this.importSubscriptionsLocally(this.subscriptions); 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> </script>

View file

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

View file

@ -220,12 +220,6 @@ const mixin = {
const localSubscriptions = this.getLocalSubscriptions(); const localSubscriptions = this.getLocalSubscriptions();
return localSubscriptions.join(","); 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: { computed: {
theme() { theme() {