Skip to content

Commit

Permalink
fix fetch call
Browse files Browse the repository at this point in the history
  • Loading branch information
amirrr committed Jan 17, 2025
1 parent 29c8abf commit 6cb33c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aws-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy to Amazon ECS

on:
workflow_run:
workflows: ["Run Tests (Frontend)", "Test Docker Containerization"]
workflows: ["Run Tests (Frontend)"]
branches: [main]
types:
- completed
Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ const Home = ({ loggingIn }: { loggingIn?: boolean }) => {
// If user *already* has a token in localStorage, validate it and possibly redirect
useEffect(() => {
const token = localStorage.getItem('token') || ''
if (!loggingIn && token) {
const email = localStorage.getItem('email') || ''
if (!loggingIn && token && email) {
setIsLoggingIn(true)
setLoggingInMessage('Authenticating your token... Please wait.')

Expand All @@ -81,7 +82,7 @@ const Home = ({ loggingIn }: { loggingIn?: boolean }) => {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email: params.email, magic_link: params.magicLink }),
body: JSON.stringify({ email: email, magic_link: token }),
}).then((res) => {
if (res.ok) {
localStorage.setItem('token', res.headers.get('Authorization')!)
Expand Down

0 comments on commit 6cb33c8

Please sign in to comment.