Selected organization should remain visible after navigating back
This commit is contained in:
parent
9886fac03e
commit
30144695f9
@ -1,4 +1,4 @@
|
|||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
useAssignOrgToTenant,
|
useAssignOrgToTenant,
|
||||||
useOrganizationBySPRID,
|
useOrganizationBySPRID,
|
||||||
@ -14,12 +14,14 @@ import { OrgCardSkeleton } from "./OrganizationSkeleton";
|
|||||||
// Zod schema: only allow exactly 4 digits
|
// Zod schema: only allow exactly 4 digits
|
||||||
|
|
||||||
const OrgPickerFromSPId = ({ title, placeholder }) => {
|
const OrgPickerFromSPId = ({ title, placeholder }) => {
|
||||||
const { onClose, startStep, flowType, onOpen, prevStep } =
|
const { onClose, startStep, flowType, onOpen, prevStep, orgData } =
|
||||||
useOrganizationModal();
|
useOrganizationModal();
|
||||||
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
|
setValue,
|
||||||
formState: { errors },
|
formState: { errors },
|
||||||
watch,
|
watch,
|
||||||
} = useForm({
|
} = useForm({
|
||||||
@ -36,7 +38,15 @@ const OrgPickerFromSPId = ({ title, placeholder }) => {
|
|||||||
setSPRID(formdata.spridSearchText);
|
setSPRID(formdata.spridSearchText);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOrg = (orgId) => {};
|
// Add this..
|
||||||
|
useEffect(() => {
|
||||||
|
if (orgData?.sprid) {
|
||||||
|
setValue("spridSearchText", orgData.sprid);
|
||||||
|
setSPRID(orgData.sprid);
|
||||||
|
}
|
||||||
|
}, [orgData, setValue]);
|
||||||
|
|
||||||
|
const handleOrg = (orgId) => { };
|
||||||
const SP = watch("spridSearchText");
|
const SP = watch("spridSearchText");
|
||||||
return (
|
return (
|
||||||
<div className="d-block">
|
<div className="d-block">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user