ezy-login
v1.0.10
Published
Made with create-react-library
Downloads
4
Readme
ezy-login
React library for user login
Install
npm install --save ezy-login
Usage
import React from 'react'
import { EzyLogin, ezyUser } from 'ezy-login'
const App = () => {
const checkIfLoggedin = () => {
let user = ezyUser.IsLoggedin() //Checks if user is already logged in
if (user.isloggedin) {
navigate('/Home')
}
else {
navigate('/login')
}
}
const logout = () => {
ezyUser.logout() //Log out
navigate('/login')
}
const onLoginSuccess = (value) => {
console.log("sucesss", value)
}
const onLoginFail = (value) => {
console.log("fail", value)
}
return <>
<EzyLogin title="title" onSuccess={onLoginSuccess} onFail={onLoginFail} />} />
</>
}
export default App
EzyLogin
| property | Description |default | return |
| --- | --- | --- | --- |
| title
| Login form title | Login | - |
| onSuccess
| Trigger after submitting the form and user is logged in successfully | - | user details/permissions |
| onFail
| Trigger after submitting the form and user login fails | - | error|
ezyUser
| method | Description |returns |
| --- | --- | --- |
| ezyUser.IsLoggedin()
| Checks if user is already logged in | object |
| ezyUser.logout()
| user logout | - |