Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 1 | Rev 5310 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1018
Línea 1... Línea 1...
1
import {axios} from "../../utils";
1
import { axios } from "../../utils";
2
import { feedActionTypes } from "./feed.types";
2
import { feedActionTypes } from "./feed.types";
Línea 3... Línea 3...
3
 
3
 
4
export const setTimelineUrl = (url) => {
4
export const setTimelineUrl = (url) => {
5
  return {
5
  return {
Línea 19... Línea 19...
19
    type: feedActionTypes.LOAD_FEEDS_SUCCESS,
19
    type: feedActionTypes.LOAD_FEEDS_SUCCESS,
20
    payload: { feeds: feeds, currentPage: currentPage, pages: pages },
20
    payload: { feeds: feeds, currentPage: currentPage, pages: pages },
21
  };
21
  };
22
};
22
};
Línea 23... Línea 23...
23
 
23
 
24
export const addFeed = (feed) => ({
24
export const addFeed = (feed, feedSharedId = '') => ({
25
  type: feedActionTypes.ADD_FEED,
25
  type: feedActionTypes.ADD_FEED,
26
  payload: feed,
26
  payload: { feed: feed, feedSharedId: feedSharedId },
Línea 27... Línea 27...
27
});
27
});
28
 
28
 
29
export const deleteFeed = (feedId) => ({
29
export const deleteFeed = (feedId) => ({
Línea 35... Línea 35...
35
  type: feedActionTypes.SET_CURRENT_PAGE,
35
  type: feedActionTypes.SET_CURRENT_PAGE,
36
  payload: page,
36
  payload: page,
37
});
37
});
Línea 38... Línea 38...
38
 
38
 
39
export const fetchFeeds = (url, page) => {
39
export const fetchFeeds = (url, page) => {
40
   (url);
40
  (url);
41
  return (dispatch) => {
41
  return (dispatch) => {
42
    dispatch(loadFeeds());
42
    dispatch(loadFeeds());
43
    axios
43
    axios
44
      .get(url+'?page='+page)
44
      .get(url + '?page=' + page)
45
      .then((res) => {
45
      .then((res) => {
46
        const resData = res.data;
46
        const resData = res.data;
47
         (resData);
47
        (resData);
48
        const feeds = resData.data.current.items;
48
        const feeds = resData.data.current.items;
49
        const currentPage = resData.data.current.page;
49
        const currentPage = resData.data.current.page;
50
        const pages = resData.data.total.pages;
50
        const pages = resData.data.total.pages;
51
        if (resData.success) {
51
        if (resData.success) {