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

Reload page when login is successful and history changes. #148

Merged
merged 5 commits into from
Jul 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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