Skip to content
Armando Assunção edited this page Feb 20, 2018 · 5 revisions

Usage

Import modules

import { MAS, MASdevice, MASUser } from 'react-native-ca-mas';

MAS.debug(): void

MAS.debug()

MAS.getState(): Promise

MAS.getState()
.then((t) => console.log('state:', t))
.catch((e) => console.log('state error:', e))

MAS.isAuthenticationListenerRegistered(): Promise

MAS.isAuthenticationListenerRegistered()
.then(res => console.log(res))
.catch(error => console.log(error))

MAS.invoke(path: string[, options: object]): Promise

MAS.invoke(path: string, {
  method: string, // default: 'GET'
  headers: object, // default: null
  body: object, // default: null
})
MAS.invoke('/foo', {
  method: 'POST',
  headers: {
    'content-type': 'application/json',
  },
  body: {
    foo: 123,
  }
})
.then(res => console.log(res))
.catch(error => console.log(error))

MASDevice.deregister(): Promise<void>

MASUser.deregister()
.then(res => console.log(res))
.catch(error => console.log(error))

MASDevice.getIdentifier(): Promise<string>

MASUser.getIdentifier()
.then(res => console.log(res))
.catch(error => console.log(error))

MASDevice.isRegistered(): Promise<boolean>

MASUser.isRegistered()
.then(res => console.log(res))
.catch(error => console.log(error))

MASDevice.resetLocally(): void

MASUser.resetLocally()

MASUser.getCurrentUser(): Promise

MASUser.getCurrentUser()
.then(res => console.log(res))
.catch(error => console.log(error))

MASUser.getAuthCredentialsType(): Promise

MASUser.getAuthCredentialsType()
.then(res => console.log(res))
.catch(error => console.log(error))

MASUser.login(username: string, password: string): Promise

MASUser.login('mark', 'dadada')
.then(res => console.log(res))
.catch(error => console.log(error))