location.js 567 Bytes
import {
  SOLICITUD_POSTED,
} from '../actions/solicitudes'

import {
  requestLocation,
  requestLocationPermission,
  LOCATION_PERMISSION_GRANTED,
  LOCATION_RECEIVED
} from '../actions/location'

export const askLocationOnPost = (action$) =>
  action$.ofType(SOLICITUD_POSTED)
    .map(requestLocationPermission)

export const getLocationOnGrant = (action$) =>
  action$.ofType(LOCATION_PERMISSION_GRANTED)
    .map(requestLocation)

export const postLocationOnReceive = (action$) =>
  action$.ofType(LOCATION_RECEIVED)
    .do(console.log)
    .ignoreElements()