2.0.2 • Published 6 years ago
@romulovalez/da-applicant-test v2.0.2
🚀 Installation
yarn add styled-components @romulovalez/da-applicant-testnpm install styled-components @romulovalez/da-applicant-testIn order to use it you will need to have access to the D'Anchiano API.
🖲 Usage
import React from 'react'
import ApplicantTest from '@romulovalez/da-applicant-test'
const Example = () => (
<ApplicantTest
baseUrl="https://dev.danchiano.com"
token="57f3fd937c4e0814ffa68c1a67f2e53d" />
)🧬 Properties
| Property | Type | Description |
|---|---|---|
| baseUrl | String | D'Anchiano base url |
| token | String | Applicant access token |
🔑 Get applicant token
GET {baseUrl}/api/v1/users/{applicantId}/token
header = {
'Authorization': 'Bearer {portalToken}',
'Accept-Language': {lang},
}| Property | Type | Description |
|---|---|---|
| portalToken | String | Portal access token (get it here) |
| lang | String | ISO 639-1 Language code |
This token will allow you to start an applicant's session on the frontend. If it does not exist or if it is expired it generates a new token. It expires after 24 hours.
You can force the generation of a new token by adding ?refresh to the request.
🛠 Endpoints
If you want to make your own frontend this are the endpoints used:
Answer the question 'people-in-charge'
POST {baseUrl}/api/v2/applicant/people-in-charge?token={token}| Property | Type | Description |
|---|---|---|
| value | bool | people at charge value |
Get the current question of the test
GET {baseUrl}/api/v2/applicant/questions?token={token}Answer the current question
POST {baseUrl}/api/v2/applicant/answer/{answerId}?token={token}| Property | Type | Description |
|---|---|---|
| answerValue | String | answer (a,b) |
Update the time elapsed in the test
PATCH {baseUrl}/api/v2/applicant/test-timer?token={token}| Property | Type | Description |
|---|---|---|
| timer | Number | time in seconds |
📝 License
MIT