Skip to content

Commit

Permalink
fix: cookies usage
Browse files Browse the repository at this point in the history
  • Loading branch information
GalvinGao committed Dec 13, 2022
1 parent fe3cf43 commit aab6e23
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export default {
this.$store.dispatch('data/fetch', false)
if (Cookies.get('userID')) {
this.$store.dispatch('auth/login', Cookies.get('userID'))
Cookies.remove('userID')
Cookies.remove("userID", { path: "/", domain: "." + window.location.hostname })
}
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default {
},
logout ({ commit }) {
commit('changeUsername', null)
Cookies.remove('userID')
Cookies.remove("userID", { path: "/", domain: "." + window.location.hostname })
}
},
getters: {
Expand Down
7 changes: 7 additions & 0 deletions src/utils/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Console from "@/utils/Console";
import mirror from "@/utils/mirror";
import axios from "axios";
import semver from "semver";
import Cookies from "js-cookie";

let baseURL;
if (mirror.global.isCurrent() || mirror.cn.isCurrent()) {
Expand Down Expand Up @@ -95,6 +96,12 @@ service.interceptors.response.use(
penguinId
);
store.dispatch("auth/login", penguinId);

// suppress cookie usage
Cookies.remove("userID", {
path: "/",
domain: "." + window.location.hostname,
});
}

return response;
Expand Down

0 comments on commit aab6e23

Please sign in to comment.