This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
Sphere/app/actions/index.js
2016-05-05 14:18:07 +01:00

42 lines
1.1 KiB
JavaScript

import methods from './methods';
import makeAsyncActionSet from './makeAsyncActionSet';
import buildAsyncAction from './buildAsyncAction';
import endpoints from '../settings/endpoints';
export const LOGIN = makeAsyncActionSet('LOGIN');
export function login(token, callback) {
return buildAsyncAction(
LOGIN,
endpoints.get('USER_INFO').query({ 'circle-token': token }),
methods.GET,
{},
{ token, callback }
);
}
export const GET_PROJECTS = makeAsyncActionSet('GET_PROJECTS');
export function getProjects(callback) {
return buildAsyncAction(
GET_PROJECTS,
endpoints.get('ALL_PROJECTS'),
methods.GET,
{},
{ callback }
);
}
export const GET_PROJECT_RECENT_BUILDS = makeAsyncActionSet('GET_PROJECT_RECENT_BUILDS');
export function getProjectRecentBuilds(user, repo, limit, offset, callback) {
return buildAsyncAction(
GET_PROJECT_RECENT_BUILDS,
endpoints.get('PROJECT_RECENTS').param({ user, repo }).query({ limit, offset }),
methods.GET,
{},
{
callback,
ident: `${user}/${repo}`
}
);
}