redux/track/selectors

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.1 kB
1
Indexable
Never
import {createSelector} from 'reselect';
import * as TrackActionType from './type';

export const track = state => state.track;

export const getTrackLoading = createSelector(
  track,
  (data: TrackActionType.TrackState) => {
    return data.trackLoading;
  },
);

export const getTrackStationList = createSelector(
  track,
  (data: TrackActionType.TrackState) => {
    return data.trackStation;
  },
);

export const getTrackTotalLength = createSelector(
  track,
  (data: TrackActionType.TrackState) => {
    return data.trackTotalLength;
  },
);

export const getStopStations = createSelector(
  track,
  (data: TrackActionType.TrackState) => {
    return data.stopStations;
  },
);

export const getTrackGroupData = createSelector(
  track,
  (data: TrackActionType.TrackState) => {
    return data.trackGroupData;
  },
);

export const getNearestTrackData = createSelector(
  track,
  (data: TrackActionType.TrackState) => {
    return data.nearestTrack;
  },
);

export const getAbsoluteStartTrackDistanceMiles = createSelector(
  track,
  (data: TrackActionType.TrackState) => {
    return data.absoluteStartTrackDistanceMiles;
  },
);