Skip to content

Commit

Permalink
renamed constants
Browse files Browse the repository at this point in the history
  • Loading branch information
itinance committed May 20, 2017
1 parent 1283d33 commit 0754525
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion actions.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { ACTION_SET_POSITION, ACTION_SET_ERROR } from './actions/index';
export { REDUX_SAGA_LOCATION_ACTION_SET_POSITION
, REDUX_SAGA_LOCATION_ACTION_SET_ERROR } from './actions/index';
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "redux-saga-location",
"version": "1.0.3",
"version": "1.0.4",
"description": "Location-support for reduy-saga",
"main": "index.js",
"scripts": {
Expand Down
7 changes: 4 additions & 3 deletions reducer/location.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {ACTION_SET_POSITION, ACTION_SET_ERROR} from '../actions';
import {REDUX_SAGA_LOCATION_ACTION_SET_POSITION
, REDUX_SAGA_LOCATION_ACTION_SET_ERROR} from '../actions';

export default function locationReducer(state = {
position: null,
error: null,
}, action) {
switch(action.type) {

case ACTION_SET_POSITION: {
case REDUX_SAGA_LOCATION_ACTION_SET_POSITION: {
const {position} = action;

return {
Expand All @@ -16,7 +17,7 @@ export default function locationReducer(state = {
}
}

case ACTION_SET_ERROR : {
case REDUX_SAGA_LOCATION_ACTION_SET_ERROR : {
const {error} = action;

return {
Expand Down
7 changes: 4 additions & 3 deletions saga/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { take, put, call } from 'redux-saga/effects';

export const locationChannel = channel()

import {ACTION_SET_POSITION, ACTION_SET_ERROR} from '../actions';
import {REDUX_SAGA_LOCATION_ACTION_SET_POSITION
, REDUX_SAGA_LOCATION_ACTION_SET_ERROR} from '../actions';

export function * watchLocationChannel() {
while (true) {
Expand All @@ -16,9 +17,9 @@ export function * watchLocationChannel() {
export function * getCurrentPosition(options) {
navigator.geolocation.getCurrentPosition(
position => {
locationChannel.put({type: ACTION_SET_POSITION, position})
locationChannel.put({type: REDUX_SAGA_LOCATION_ACTION_SET_POSITION, position})
},
(error) => locationChannel.put({type: ACTION_SET_ERROR, error}),
(error) => locationChannel.put({type: REDUX_SAGA_LOCATION_ACTION_SET_ERROR, error}),
options
);

Expand Down

0 comments on commit 0754525

Please sign in to comment.