import alt from '../alt'
import PoemSource from '../sources/PoemSource'

class PoemActions {
  constructor() {
    this.generateActions(
      'sync',
      'fetchedPoems',
      'addedPoem',
    )
  }

  addPoem(poem) {
    PoemSource.add(poem)
  }

  deletePoem(poem) {
    PoemSource.delete(poem.id)
    return poem
  }
}

export default alt.createActions(PoemActions)

import alt from '../alt'
import MandaySource from '../sources/MandaySource'

class PoemActions {
  constructor() {
    this.generateActions(
      'fetchedPoems',
      'addedPoem',
    )
    this.endpoint = 'poems'
  }

  sync(date) {
    MandaySource.fetchAt(this.endpoint, date, this.fetchedPoems)
  }

  addPoem(poem) {
    MandaySource.add(this.endpoint, poem, this.addedPoem)
  }

  deletePoem(poem) {
    MandaySource.delete(this.endpoint, poem.id)
    return poem
  }
}

export default alt.createActions(PoemActions)

Change from PoemSource to common source
Change from PoemSource to common source
