fix #301 should push to "/files"

This commit is contained in:
Cindy Chang
2024-06-14 11:30:43 +08:00
parent 13bc3882ed
commit d47b17f575
2 changed files with 4 additions and 3 deletions

View File

@@ -35,7 +35,6 @@ export default defineStore('loginStore', {
const response = await axios.post(api, this.auth, config);
const accessToken = response.data.access_token;
const refreshToken = response.data.refresh_token;
// 將 token 儲存在 cookie
document.cookie = `luciaToken=${accessToken}`;
// document.cookie = `luciaRefreshToken=${refreshToken};expires=${new Date(this.expired)};`;
@@ -48,7 +47,7 @@ export default defineStore('loginStore', {
if(this.rememberedReturnToUrl !== "") {
window.location.href = atob(this.rememberedReturnToUrl);
} else {
this.$router.push('/login');
this.$router.push('/files');
}
} catch(error) {
this.isInvalid = true;

View File

@@ -106,7 +106,9 @@ export default {
created() {
// 考慮到使用者可能在未登入的情況下貼入一個頁面網址連結過來瀏覽器
// btoa: 對字串進行 Base64 編碼
this.setRememberedReturnToUrl(btoa(this.$route.query['return-to']));
if(this.$route.query['return-to']) {
this.setRememberedReturnToUrl(btoa(this.$route.query['return-to']));
}
},
};
</script>