Skip to content

Commit

Permalink
feat: login working
Browse files Browse the repository at this point in the history
Signed-off-by: Azanul <azanulhaque@gmail.com>
  • Loading branch information
Azanul committed Jun 4, 2024
1 parent d938673 commit 9188778
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions api-gateway/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ func CORSHandler(next http.Handler) http.Handler {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
w.Header().Set("Access-Control-Expose-Headers", "Content-Type, Authorization")

if r.Method == http.MethodOptions {
w.WriteHeader(http.StatusOK)
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/AuthForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const AuthForm: React.FC<{ mode: 'login' | 'register' }> = ({ mode }) => {
});

if (response.ok) {
const token = response.headers.get('AUTHORIZATION');
const token = response.headers.get('Authorization');

if (token) {
localStorage.setItem('token', token);
navigate('/');
Expand Down

0 comments on commit 9188778

Please sign in to comment.