Skip to content

Commit

Permalink
Fix login functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
etienne committed Feb 18, 2024
1 parent 56fc2c9 commit 5f799fb
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions frontend/src/app/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,13 @@ export default function SignIn() {
} else if (response.status === 401) {
setIsLoading(false);
alert("Invalid password");
} else if (response.status === 200) {
} else {
const data = await response.json();
localStorage.setItem("token", data.token);
const decodedToken: any = jwt.decode(data.token);
localStorage.setItem("userId", decodedToken.id);
localStorage.setItem("name", username);
router.push("/chat");
} else {
setIsLoading(false);
console.log(response.status);
alert(response);
}
};

Expand Down

0 comments on commit 5f799fb

Please sign in to comment.