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 {
|
||||
useAssignOrgToTenant,
|
||||
useOrganizationBySPRID,
|
||||
@ -14,12 +14,14 @@ import { OrgCardSkeleton } from "./OrganizationSkeleton";
|
||||
// Zod schema: only allow exactly 4 digits
|
||||
|
||||
const OrgPickerFromSPId = ({ title, placeholder }) => {
|
||||
const { onClose, startStep, flowType, onOpen, prevStep } =
|
||||
const { onClose, startStep, flowType, onOpen, prevStep, orgData } =
|
||||
useOrganizationModal();
|
||||
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
setValue,
|
||||
formState: { errors },
|
||||
watch,
|
||||
} = useForm({
|
||||
@ -36,7 +38,15 @@ const OrgPickerFromSPId = ({ title, placeholder }) => {
|
||||
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");
|
||||
return (
|
||||
<div className="d-block">
|
||||
|
Loading…
x
Reference in New Issue
Block a user