All files / @tech/pdf actions.js

100% Statements 8/8
100% Branches 0/0
100% Functions 4/4
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40              1x                 1x                 1x                   1x        
import { SET_PDF, RESET_PDF, SET_ERROR, SET_LOADING } from './constants';
 
/**
 * Set fetched pdf local uri
 * @param {String} pdf
 * @return {Object}
 */
export const setPdf = pdf => ({
  type: SET_PDF,
  payload: { pdf },
});
 
/**
 * Set the PDF path to null
 * @return {Object}
 */
export const resetPdf = () => ({
  type: RESET_PDF,
});
 
/**
 * Set a flag indicating an error with PDF fetch
 * @param {Boolean} error
 * @returns {Object}
 */
export const setError = error => ({
  type: SET_ERROR,
  payload: { error },
});
 
/**
 * Set a flag indicating loading state
 * @param {Boolean} loading
 * @returns {Object}
 */
export const setLoading = loading => ({
  type: SET_LOADING,
  payload: { loading },
});