Skip to content

Commit

Permalink
fix editing patient
Browse files Browse the repository at this point in the history
  • Loading branch information
artweb11 committed Nov 17, 2023
1 parent 3a8dd6e commit 1d068c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion components/atoms/Stepper/Forms/identity2.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import CountrySelect from '../../Input/Country';
export const CountryContext = createContext();

function Identity2() {
const ls = localStorage.getItem('dispatchBuyVoucher');

const { activeStepIndex, setActiveStepIndex, formData, setFormData } =
useContext(FormContext);
const [phone, setPhone] = useState();
Expand All @@ -41,7 +43,7 @@ function Identity2() {
const dispatch = useDispatch();
const [state, setState] = useState({ type: 0, message: '' });
const client = useSelector((state) => state.app.client);
const [newBenecifiare, setNewBenecifiare] = useState(false);
const [newBenecifiare, setNewBenecifiare] = useState( ls && JSON.parse(ls).id? true : false );
const [activeIndexSlide, setActiveIndexSlide] = useState(null);
const [country, setCountry] = useState('cd');
const [countryLabel, setCountryLabel] = useState('RD Congo');
Expand Down Expand Up @@ -102,6 +104,10 @@ function Identity2() {
);
setActiveStepIndex(activeStepIndex + 1);
} else {
const ls = JSON.parse( localStorage.getItem('dispatchBuyVoucher') );
if( ls && ls.id ){
data.id = ls.id;
}
savePatientMutation.mutate({ ...data, accessToken: session.accessToken });
}
};
Expand Down
2 changes: 1 addition & 1 deletion lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export async function savePatient(formData) {
delete formData.accessToken;

const Options = {
method: 'POST',
method: formData?.id? 'PUT' : 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
Expand Down
2 changes: 1 addition & 1 deletion pages/voucher/buy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Page = () => {
step == 'end' && redirect_status == 'succeeded' ? 2 : step == '1' ? 1 : 0,
);
const [formData, setFormData] = useState({});
const [kycTest, setKycTest] = useState(true);
const [kycTest, setKycTest] = useState(false);

return (
<>
Expand Down

0 comments on commit 1d068c5

Please sign in to comment.