[WEB-5657] chore: synchronization configuration for multiple providers in authentication adapter #8409
This commit is contained in:
parent
c2ce21e56c
commit
46453560f2
1 changed files with 5 additions and 7 deletions
|
|
@ -26,13 +26,11 @@ export function ControllerSwitch<T extends FieldValues>(props: Props<T>) {
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name={name as FieldPath<T>}
|
name={name as FieldPath<T>}
|
||||||
render={({ field: { value, onChange } }) => (
|
render={({ field: { value, onChange } }) => {
|
||||||
<ToggleSwitch
|
const parsedValue = Number.parseInt(typeof value === "string" ? value : String(value ?? "0"), 10);
|
||||||
value={Boolean(parseInt(value))}
|
const isOn = !Number.isNaN(parsedValue) && parsedValue !== 0;
|
||||||
onChange={() => (parseInt(value) ? onChange("0") : onChange("1"))}
|
return <ToggleSwitch value={isOn} onChange={() => onChange(isOn ? "0" : "1")} size="sm" />;
|
||||||
size="sm"
|
}}
|
||||||
/>
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue