Authorization is now a cookie so removed localStorage code

Update some structure in how we request and save settings. Updated
Settings & Profile to reflect these changes.
This commit is contained in:
2022-03-04 18:20:50 +01:00
parent ca4d87b315
commit 95ad74a1b5
3 changed files with 96 additions and 55 deletions

View File

@@ -43,7 +43,7 @@ import Settings from "@/components/Settings";
import Activity from "@/components/ActivityPage";
import SeasonedButton from "@/components/ui/SeasonedButton";
import { getEmoji, getUserRequests, getSettings } from "@/api";
import { getEmoji, getUserRequests, getSettings, logout } from "@/api";
export default {
components: { ListHeader, ResultsList, Settings, Activity, SeasonedButton },
@@ -67,7 +67,7 @@ export default {
}
},
methods: {
...mapActions("user", ["logout", "updateSettings"]),
...mapActions("user", ["logout", "setSettings"]),
toggleSettings() {
this.showSettings = this.showSettings ? false : true;
@@ -98,15 +98,17 @@ export default {
this.updateQueryParams("activity", this.showActivity);
},
_logout() {
this.logout();
this.$router.push("home");
logout().then(() => {
this.logout();
this.$router.push("home");
});
}
},
created() {
if (!this.settings) {
getSettings().then(resp => {
const { settings } = resp;
if (settings) updateSettings(settings);
if (settings) this.setSettings(settings);
});
}