@workamo/react-validation-widget
v1.0.0
Published
Widget for validating Swedish personal numbers written in React.
Downloads
1
Readme
Personal number validation widget
Widget for validating Swedish personal numbers written in React.
Installation
Use the package manager npm to install widget.
The package needs to be configured with your domain additionaly. Please contact [email protected].
npm install @workamo/react-validation-widget
Usage
Wrap your component e.g. <PartnerExampleComponent />
with Workamo wrapper <WorkamoValidationWrapper />
and pass app root id to WorkamoValidationWrapper
.
import { WorkamoValidationWrapper } from "@workamo/react-validation-widget";
<WorkamoValidationWrapper appRootId="root">
<PartnerExampleComponent />
</WorkamoValidationWrapper>
Import useWorkamoValidation hook and validate personal number as described.
import { useWorkamoValidation } from "@workamo/react-validation-widget";
const { verifyPersonalNumber } = useWorkamoValidation();
verifyPersonalNumber(personalNumber)
.then(res => {
console.log(res);
})
.catch(err => {
console.log("Error", err);
});