client/src/sagas/index.js
changeset 54 fad489be9c77
parent 53 d8588379529e
child 55 a2761c5be551
equal deleted inserted replaced
53:d8588379529e 54:fad489be9c77
     2 import { put, take, takeLatest, all } from 'redux-saga/effects'
     2 import { put, take, takeLatest, all } from 'redux-saga/effects'
     3 import * as types from '../constants/actionTypes';
     3 import * as types from '../constants/actionTypes';
     4 import PouchDBFind from 'pouchdb-find';
     4 import PouchDBFind from 'pouchdb-find';
     5 import Immutable from 'immutable';
     5 import Immutable from 'immutable';
     6 import APIClient from '../APIClient';
     6 import APIClient from '../APIClient';
       
     7 import config from '../config';
     7 
     8 
     8 PouchDB.debug.disable();
     9 PouchDB.debug.disable();
     9 PouchDB.plugin(PouchDBFind);
    10 PouchDB.plugin(PouchDBFind);
    10 
    11 
    11 const sessionsDB = new PouchDB('sessions');
    12 const sessionsDB = new PouchDB('sessions');
    12 const notesDB = new PouchDB('notes');
    13 const notesDB = new PouchDB('notes');
    13 notesDB.createIndex({
    14 notesDB.createIndex({
    14   index: { fields: ['session'] }
    15   index: { fields: ['session'] }
    15 });
    16 });
    16 
    17 
    17 const client = new APIClient('http://localhost:8000')
    18 const client = new APIClient(config.apiRootUrl);
    18 
    19 
    19 // ---
    20 // ---
    20 
    21 
    21 export function* loadSessions() {
    22 export function* loadSessions() {
    22   const response = yield sessionsDB.allDocs({ include_docs: true })
    23   const response = yield sessionsDB.allDocs({ include_docs: true })