Skip to content

Commit

Permalink
[muzi] refactoring tunes reducer to use tunes types ✊
Browse files Browse the repository at this point in the history
  • Loading branch information
zulucoda committed Aug 24, 2018
1 parent 3d8d835 commit 091ba22
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/components/react-tunes-player/react-tunes-player-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@
* Copyright mfbproject.co.za - muzi@mfbproject.co.za
* Copyright zulucoda - mfbproject
*/

// @flow

import _findIndex from "lodash/findIndex";
import {
REACT_TUNES_PLAYER_PAUSE_CURRENT_TUNE,
REACT_TUNES_PLAYER_PLAY_CURRENT_TUNE,
REACT_TUNES_PLAYER_SET_CURRENT_TUNE,
REACT_TUNES_PLAYER_SET_NEXT_TUNE,
REACT_TUNES_PLAYER_SET_PREVIOUS_TUNE,
REACT_TUNES_PLAYER_SET_TUNES
} from "./constants";
import type { TunesAction } from "./types/tunes-player.types";
import type { Tunes } from "./types/tunes.types";

const initialState = {
tunes: [],
Expand All @@ -17,20 +30,9 @@ const initialState = {
}
};

const REACT_TUNES_PLAYER_SET_TUNES = "REACT_TUNES_PLAYER_SET_TUNES";
const REACT_TUNES_PLAYER_SET_CURRENT_TUNE =
"REACT_TUNES_PLAYER_SET_CURRENT_TUNE";
const REACT_TUNES_PLAYER_PLAY_CURRENT_TUNE =
"REACT_TUNES_PLAYER_PLAY_CURRENT_TUNE";
const REACT_TUNES_PLAYER_PAUSE_CURRENT_TUNE =
"REACT_TUNES_PLAYER_PAUSE_CURRENT_TUNE";
const REACT_TUNES_PLAYER_SET_NEXT_TUNE = "REACT_TUNES_PLAYER_SET_NEXT_TUNE";
const REACT_TUNES_PLAYER_SET_PREVIOUS_TUNE =
"REACT_TUNES_PLAYER_SET_PREVIOUS_TUNE";

export const setTunes = payload => ({
export const setTunes = (tunes: Tunes): TunesAction => ({
type: REACT_TUNES_PLAYER_SET_TUNES,
payload
tunes
});

export const setCurrentTune = payload => ({
Expand Down

0 comments on commit 091ba22

Please sign in to comment.