States and Selectors - Template

|-/redux
    |
    |-/kyc
        |- index.ts
        |- kycSlice.ts
        |- kycThunks.ts
Initial State
kycSlice.ts
const initialState: SliceState = {
  requieredDocuments: {
    id: '',
    kycDocuments: [{category: null, options: null, outcome: null}],
    kycStatus: '',
  },
  postDocumentResponse: {
    statusCode: 0,
    message: '',
    error: '',
  },
  isLoadingKyc: false,
  categoryDocument: {
    category: {name: '', value: ''},
    options: [],
    outcome: '',
  },
};
Selectors
  • getRequiredDocuments: This selector helps to get the required pending documents for the KYC validation.

  • getIsLoadingKyc: This selector helps when some functionality is in process and is needed to wait.

  • getCategoryDocument: This selector helps to get the category of the selected document and its options.

  • getDocumentsId: This selector is used to get the id of a specific document.

How to get pending documents?

Invoke fetchGetRequiredDocuments from redux/kyc using LinkerStudio/core/hooks useAppDispatch

import {useAppDispatch} from 'LinkerStudio/core/hooks';

const dispatch = useAppDispatch();

await dispatch(fetchGetRequiredDocuments());

How to upload a pending document?

Invoke fetchPostRequiredDocument from redux/kyc using LinkerStudio/core/hooks useAppDispatch

import {useAppDispatch} from 'LinkerStudio/core/hooks';

const dispatch = useAppDispatch();

await dispatch(fetchPostRequiredDocument(body));
ParameterTypeDescription

body

Document

The object with the data of the document: id, the base64 of the document, the file type, the file name, a note usually describing the device and platform and the selected option for the document.

Last updated