From ea0a61641a77cce55304d258fb89762f5c94aa1e Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 15 Jun 2024 13:36:57 +1000 Subject: [PATCH] testing responses from backend --- client/src/components/sidebar/UserAccount.tsx | 12 ++++++++++-- server/src/auth/auth.service.ts | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/src/components/sidebar/UserAccount.tsx b/client/src/components/sidebar/UserAccount.tsx index a634ceb82..0905789b2 100644 --- a/client/src/components/sidebar/UserAccount.tsx +++ b/client/src/components/sidebar/UserAccount.tsx @@ -73,9 +73,17 @@ const UserAccount: React.FC = ({ 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 () => { diff --git a/server/src/auth/auth.service.ts b/server/src/auth/auth.service.ts index 15e9f7a10..5a3d9fda6 100644 --- a/server/src/auth/auth.service.ts +++ b/server/src/auth/auth.service.ts @@ -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 { @@ -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) => { @@ -31,4 +31,4 @@ export class AuthService { }); }); } -} \ No newline at end of file +}