import {
  LOAD_REPOS,
  LOAD_REPOS_ERROR,
  LOAD_REPOS_SUCCESS,
  SET_AUTHORITY,
  SET_USER_MODE,
  SET_LOGIN_NAME,
} from './constants';

export function loadRepos() {
  return {
    type: LOAD_REPOS,
  };
}

export function reposLoaded(repos, username) {
  return {
    type: LOAD_REPOS_SUCCESS,
    repos,
    username,
  };
}

export function repoLoadingError(error) {
  return {
    type: LOAD_REPOS_ERROR,
    error,
  };
}

export function setAuth(auth) {
  return {
    type: SET_AUTHORITY,
    auth,
  };
}

export function setUserMode(userMode) {
  return {
    type: SET_USER_MODE,
    userMode,
  };
}

export function setLoginName(loginName) {
  return {
    type: SET_LOGIN_NAME,
    loginName,
  };
}