From 1a73d898f716e49add79c2dfae4751643b49cd32 Mon Sep 17 00:00:00 2001 From: mario Date: Fri, 23 May 2025 14:15:27 +0700 Subject: [PATCH] edit FE shorlink auth, no login route, deployed dicomv.aplikasi.web.id --- platform/app/public/config/google.js | 1 + platform/app/src/App.tsx | 2 +- platform/app/src/routes/Login.tsx | 13 +++++++++++-- platform/app/src/routes/ShortlinkLogin.tsx | 18 +++++++++++++----- .../src/utils/initUserAuthenticationService.js | 3 ++- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/platform/app/public/config/google.js b/platform/app/public/config/google.js index f9b4c9f..cd82934 100644 --- a/platform/app/public/config/google.js +++ b/platform/app/public/config/google.js @@ -3,6 +3,7 @@ window.config = { routerBasename: '/', pacs_document_host: `https://${window.location.hostname}`, pacs_document_port: 8585, + goProxyHost: `https://${window.location.hostname}:5555`, expertise: false, //* Tambahan untuk enable expertise (CustomizableViewportOverlay) expertise_host: `https://devone.aplikasi.web.id/one-api/mockup/pacsmwl/Workorder/get_dummy_expertise`, //* Tambahan untuk fetch data Expertise) enableGoogleCloudAdapter: false, diff --git a/platform/app/src/App.tsx b/platform/app/src/App.tsx index 1436ded..85c4878 100644 --- a/platform/app/src/App.tsx +++ b/platform/app/src/App.tsx @@ -63,7 +63,7 @@ function injectAuth() { // Check for auth errors (401/403) and redirect to login if needed if (this.status === 401 || this.status === 403) { window.sessionStorage.removeItem('ohif-auth-token'); - window.location.href = '/login'; + // window.location.href = '/login'; // Kalau mau pakae login tinggal uncomment } } catch (e) { console.error('Error handling auth response:', e); diff --git a/platform/app/src/routes/Login.tsx b/platform/app/src/routes/Login.tsx index ae0cc23..2548fe8 100644 --- a/platform/app/src/routes/Login.tsx +++ b/platform/app/src/routes/Login.tsx @@ -1,6 +1,7 @@ import React, { useState, useEffect } from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; import { useUserAuthentication } from '@ohif/ui'; +import { Icons } from '@ohif/ui-next'; const Login = () => { const [email, setEmail] = useState(''); @@ -83,8 +84,13 @@ const Login = () => { return (
-
-

Login to OHIF Viewer

+
+
+ +
+ +

Login to

+

Cloud DICOM Viewer

{error &&
{error}
} @@ -120,6 +126,9 @@ const Login = () => { {isLoading ? 'Logging in...' : 'Log In'}
+

+ Powered by OHIF & Google Cloud DICOM Storage +

diff --git a/platform/app/src/routes/ShortlinkLogin.tsx b/platform/app/src/routes/ShortlinkLogin.tsx index 2311142..64d4f8d 100644 --- a/platform/app/src/routes/ShortlinkLogin.tsx +++ b/platform/app/src/routes/ShortlinkLogin.tsx @@ -1,6 +1,7 @@ import React, { useState, useEffect } from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; import { useUserAuthentication } from '@ohif/ui'; +import { Icons } from '@ohif/ui-next'; const ShortlinkLogin = () => { const [dob, setDob] = useState(''); @@ -22,7 +23,7 @@ const ShortlinkLogin = () => { // No short token found, redirect to regular login setError('No shortlink token found in URL'); setTimeout(() => { - navigate('/login', { replace: true }); + navigate('/', { replace: true }); }, 3000); } }, [location.search, navigate]); @@ -93,15 +94,19 @@ const ShortlinkLogin = () => { return (
-
-

Patient Access

+
+
+ +
+ +

Cloud DICOM Viewer

{error &&
{error}
}
{ className="focus:shadow-outline w-full rounded bg-blue-500 py-2 px-4 font-bold text-white hover:bg-blue-700 focus:outline-none" disabled={isLoading || !shortToken} > - {isLoading ? 'Verifying...' : 'Access My Images'} + {isLoading ? 'Verifying...' : 'View'}
+

+ Powered by OHIF & Google Cloud DICOM Storage +

diff --git a/platform/app/src/utils/initUserAuthenticationService.js b/platform/app/src/utils/initUserAuthenticationService.js index a527066..0c14225 100644 --- a/platform/app/src/utils/initUserAuthenticationService.js +++ b/platform/app/src/utils/initUserAuthenticationService.js @@ -25,7 +25,8 @@ export function initializeCustomAuth(userAuthenticationService) { window.sessionStorage.removeItem('ohif-auth-token'); // Redirect to login page with the redirect URL in query params - window.location.href = `/login?redirect=${encodeURIComponent(currentPath)}`; + // window.location.href = `/login?redirect=${encodeURIComponent(currentPath)}`; + window.location.href = '/'; // Return null to prevent rendering while redirecting return null;