Api Services
Library for connecting to api services.
Installation
npm install @rivium/api_services
Usage
import useApi from '@rivium/api_services'
const { auth } = useApi(import.meta.env.VITE_API_URL)
const example = async () => {
const response = await auth.login()
console.log(response)
}
List of Available Methods
Auth
Login
Attempt to login to the api. Saves the token on a cookie if successful.
Usage
auth.login({ params })
Params
Name | Type | Description |
---|
user | string | User email |
password | string | User password |
User
Get
Get user info by id.
Usage
user.get(params)
Params
Name | Type | Description |
---|
id | string | User id |
Create
Create a new user.
Usage
user.create({ params })
Params
Name | Type | Description |
---|
nombre | string | User name |
apellidoPaterno | string | User last name |
apellidoMaterno | string | User second last name |
sexo | string | gender |
fechaNacimiento | string | birth date |
numeroCelular | string | phone number |
curp | string | CURP |
rfc | string | RFC |
homoclave | string | RFC homoclave |
cp | string | postal code |
municipio | string | municipality |
colonia | string | colony |
calle | string | street |
numeroExterior | string | exterior number |
numeroInterior | string | interior number |
origenesDinero | string | money origins |
tipoOperaciones | string | operation type |
usoActivosVirtuales | string | virtual assets use |
OTP
Send
Send OTP code to user phone.
Usage
otp.send(params)
Params
Name | Type | Description |
---|
cellphone | string | User phone number |