diff --git a/src/components/creation/CreateABHAAddress.jsx b/src/components/creation/CreateABHAAddress.jsx index 715e87f..fa1d1f0 100644 --- a/src/components/creation/CreateABHAAddress.jsx +++ b/src/components/creation/CreateABHAAddress.jsx @@ -1,7 +1,7 @@ import React, {useState} from "react"; import './creation.scss'; import Spinner from "../spinner/spinner"; -import {checkIfABHAAddressExists, createABHAAddress} from "../../api/hipServiceApi"; +import {checkIfABHAAddressExists, createABHAAddress, createDefaultHealthId} from "../../api/hipServiceApi"; import Footer from "./Footer"; import {cmSuffixProperty} from "../../api/constants"; @@ -35,6 +35,7 @@ const CreateABHAAddress = (props) => { if (response.data === undefined) { processingError(response); } else { + setNewAbhaAddress(newAbhaAddress.concat(cmSuffix)); props.setABHAAddressCreated(true); } } @@ -51,6 +52,20 @@ const CreateABHAAddress = (props) => { } } + async function createDefault() { + setLoader(true); + setError(''); + const response = await createDefaultHealthId(); + if (response.data !== undefined) { + props.setABHAAddressCreated(true); + setNewAbhaAddress(response.data.healthId); + } + else { + setError(response.details[0].message || response.message) + } + setLoader(false); + } + function processingError(response){ if (response.details !== undefined && response.details.length > 0) setError(response.details[0].message) @@ -64,28 +79,32 @@ const CreateABHAAddress = (props) => { return (
Click on the check box to make the above abha-address as a default
- {error !== '' &&Click on the check box to make the above abha-address as a default
+ {error !== '' &&