reactnative-client
  • @dormakaba/digital-reactnative-client
  • Getting started
  • Changelog
  • Concerns
    • App State
    • Global / Local Snacks
    • Forms
    • Navigation
    • i18n
    • rest api
  • Utils
    • formatters
    • EventEmitter
    • Logger
    • settings
    • validate
    • misc
Powered by GitBook
On this page
  1. Concerns

rest api

Consumer API for rest api.

import {
  getJSON,
  postJSON,
  putJSON,
  delJSON,
  postData,
  putData,
} from '@dormakaba/digital-reactnative-client';

const res = getJSON(route, options);
const res = postJSON(route, data, options);
const res = putJSON(route, data, options);
const res = delJSON(route, options);

const res = postData(route, data, options);
const res = putData(route, data, options);

If a route does not start with http(s):// it will take the host defined in settings util settings.get('restApi.url').

For requests needing authorization you can set options { authorized: true } it will set Authorization: Bearer ${token} with the token taken from settings util settings.get('restApi.token').

Request options

Name

Type

Description

authorized

boolean

Set Bearer token like described in above hint

headers

object

Additional headers to send

Previousi18nNextformatters

Last updated 6 years ago