Skip to content

Commit

Permalink
testing responses from backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayahhhmed committed Jun 15, 2024
1 parent dacd223 commit ea0a616
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions client/src/components/sidebar/UserAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,17 @@ const UserAccount: React.FC<UserAccountProps> = ({ collapsed }) => {
// https://stackoverflow.com/a/55854902/1098564
// eslint-disable-next-line
}, []);
const loginCall = () => {
const loginCall = async () => {
setWindowLocation(window.location.href);
window.location.replace(`${API_URL.server}/auth/login`);
try {
const response = await fetch(`${API_URL.server}/auth/login`, {
// credentials: 'include',
});
console.log(response);
} catch (error) {
console.log(error);
}
// window.location.replace(`${API_URL.server}/auth/login`);

};
const logoutCall = async () => {
Expand Down
6 changes: 3 additions & 3 deletions server/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable, Request, Res } from '@nestjs/common';
import { Response } from 'express';
import { Issuer } from 'openid-client';
import { REDIRECT_LINK } from '../config';
import { config } from '../config';

@Injectable()
export class AuthService {
Expand All @@ -13,7 +13,7 @@ export class AuthService {
);

if (!id_token || !TrustIssuer) {
return res.redirect(REDIRECT_LINK);
return res.redirect(config.redirect_link);
}

req.logout((err) => {
Expand All @@ -31,4 +31,4 @@ export class AuthService {
});
});
}
}
}

0 comments on commit ea0a616

Please sign in to comment.