Add fetch request with custom headers in Modules component before opening launch URL. This ensures proper handling of tunnel reminders for super admins while maintaining existing functionality.

This commit is contained in:
Yashwin 2026-02-03 19:27:35 +05:30
parent 73e533694e
commit 2f10b23400

View File

@ -80,6 +80,20 @@ const Modules = (): ReactElement => {
const launchTenantId = isSuperAdmin ? tenantId : null; const launchTenantId = isSuperAdmin ? tenantId : null;
const response = await moduleService.launch(moduleId, launchTenantId); const response = await moduleService.launch(moduleId, launchTenantId);
if (response.success && response.data.launch_url) { if (response.success && response.data.launch_url) {
// Make a fetch request with custom headers first
try {
await fetch(response.data.launch_url, {
method: 'GET',
headers: {
'bypass-tunnel-reminder': 'true',
},
credentials: 'include',
});
} catch (fetchError) {
// Ignore fetch errors, we'll still open the URL
console.warn('Failed to send header request:', fetchError);
}
// Open the URL in a new tab
window.open(response.data.launch_url, '_blank', 'noopener,noreferrer'); window.open(response.data.launch_url, '_blank', 'noopener,noreferrer');
} }
} catch (err: any) { } catch (err: any) {