Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Toggle } from '../../../../../../../../shared/defguard-ui/components/La
import type { ToggleOption } from '../../../../../../../../shared/defguard-ui/components/Layout/Toggle/types';
import { clientApi } from '../../../../../../clientAPI/clientApi';
import {
ClientConnectionType,
ClientTrafficPolicy,
type CommonWireguardFields,
type DefguardInstance,
Expand Down Expand Up @@ -57,16 +58,23 @@ export const LocationCardRoute = ({ location, selectedDefguardInstance }: Props)
}, [LL.pages, selectedDefguardInstance?.client_traffic_policy]);

let selected: number;
if (selectedDefguardInstance?.client_traffic_policy === ClientTrafficPolicy.NONE) {
selected = Number(location?.route_all_traffic);
} else if (
selectedDefguardInstance?.client_traffic_policy ===
ClientTrafficPolicy.DISABLE_ALL_TRAFFIC
) {
selected = 0;
// check traffic policy for Defguard locations
if (location?.connection_type === ClientConnectionType.LOCATION) {
if (selectedDefguardInstance?.client_traffic_policy === ClientTrafficPolicy.NONE) {
selected = Number(location?.route_all_traffic);
} else if (
selectedDefguardInstance?.client_traffic_policy ===
ClientTrafficPolicy.DISABLE_ALL_TRAFFIC
) {
selected = 0;
} else {
selected = 1;
}
} else {
selected = 1;
// fall back to selected value for basic WireGuard tunnels
selected = Number(location?.route_all_traffic);
}

return (
<Toggle
className="location-traffic-toggle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const MfaMobileApprove = ({
socket?.close();
// go back to previous step
onCancel();
}
};

return (
<div id="mobile-approve-mfa">
Expand Down