Hooks
Description of the hooks contained in the module
usePayrollSwitchRegister
This hook is used to retrieve and connect the user account data to register it.
How to use the hook?
Import the hook:
import {usePayrollSwitchRegister} from 'LinkerStudio/modules/payroll/common/hooks/usePayrollSwitchRegister';
2. Declare a const for the hook:
const [register] = usePayrollSwitchRegister();
3. Call the const declared for the hook:
const openPayrollModal = useCallback(async () => {
const linkTokenRes = await register();
if (!linkTokenRes || linkTokenRes?.status !== 201) {
// Something went wrong
}
// Save linkTokenRes data to use it
setLinkToken(linkTokenRes?.data.data.data.token || '');
// Open payroll widget
}, [register]);
Last updated
Was this helpful?