Browse Source

fix(Login/Register): user should be returned to their most recent page after auth.

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 4 years ago
parent
commit
52f4726f22

+ 1 - 1
frontend/src/App.vue

@@ -108,7 +108,7 @@ export default {
 		});
 
 		if (localStorage.getItem("github_redirect")) {
-			this.$router.go(localStorage.getItem("github_redirect"));
+			this.$router.push(localStorage.getItem("github_redirect"));
 			localStorage.removeItem("github_redirect");
 		}
 

+ 6 - 1
frontend/src/components/modals/Login.vue

@@ -101,7 +101,7 @@ export default {
 				password: this.password
 			})
 				.then(res => {
-					if (res.status === "success") window.location.href = "/";
+					if (res.status === "success") window.location.reload();
 				})
 				.catch(
 					err => new Toast({ content: err.message, timeout: 5000 })
@@ -113,6 +113,11 @@ export default {
 		},
 		githubRedirect() {
 			localStorage.setItem("github_redirect", this.$route.path);
+			console.log(
+				"Yes",
+				this.$route.path,
+				localStorage.getItem("github_redirect")
+			);
 		},
 		...mapActions("modalVisibility", ["closeModal"]),
 		...mapActions("user/auth", ["login"])

+ 1 - 4
frontend/src/pages/Profile/tabs/RecentActivity.vue

@@ -80,10 +80,7 @@ export default {
 			ws.onConnect(() =>
 				this.socket.dispatch(
 					"apis.joinRoom",
-					`profile-${this.userId}-activities`,
-					res => {
-						console.log("res of joining activities room", res);
-					}
+					`profile-${this.userId}-activities`
 				)
 			);