Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

Commit

Permalink
Reload page when login is successful and history changes. (#148)
Browse files Browse the repository at this point in the history
* added location.reload() when history changes

* removed console.logs

* removed console.log
  • Loading branch information
andrea-grapl authored Jul 16, 2020
1 parent cf41f0b commit 8d280b2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/js/engagement_view/src/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export const LogIn = (_: LoginProps) => {

const loginSuccess = await login(values.userName, password);

if (loginSuccess) {
if (await loginSuccess) {
window.history.replaceState('/login', "", "/")
console.log("Logged in");
window.location.reload();
} else {
console.warn("Login failed!")
}
Expand All @@ -43,7 +43,7 @@ export const LogIn = (_: LoginProps) => {
<Form>
<Field name="userName" type="text" placeholder="Username" /> <br/>
<Field name="password" type="password" placeholder="Password"/> <br/>
<button className="submitBtn" type="submit">Submit</button>
<button className="submitBtn" type="submit"> Submit </button>
</Form>
</Formik>

Expand Down Expand Up @@ -95,7 +95,6 @@ const login = async (username: string, password: string) => {
});

const body = await res.json();
console.log("body", body);
return body['success'] === 'True';
} catch (e) {
console.log(e);
Expand Down

0 comments on commit 8d280b2

Please sign in to comment.