Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Api actions
- */
- import * as constants from './constants.api';
- // POST auth
- export function apiAuthCredentialsStartAction(credentials) {
- return { type: constants.API_AUTH_CREDENTIALS_REQUEST_SUCCESS, credentials };
- }
- export function apiAuthCredentialsSuccessAction(credentials) {
- return { type: constants.API_AUTH_CREDENTIALS_REQUEST_SUCCESS, credentials };
- }
- export function apiAuthCredentialsFailureAction(error) {
- return { type: constants.API_AUTH_CREDENTIALS_REQUEST_FAILURE, error };
- }
- // POST authGoogle
- export function apiAuthGoogleStartAction(googleCredentials) {
- return { type: constants.API_AUTH_GOOGLE_REQUEST, credentials: googleCredentials };
- }
- export function apiAuthGoogleSuccessAction(credentials) {
- return { type: constants.API_AUTH_GOOGLE_REQUEST_SUCCESS, credentials };
- }
- export function apiAuthGoogleFailureAction(error) {
- return { type: constants.API_AUTH_GOOGLE_REQUEST_FAILURE, error };
- }
- // POST authRefresh
- export function apiAuthRefreshStartAction(refreshToken) {
- return { type: constants.API_AUTH_REFRESH_REQUEST, refreshToken };
- }
- export function apiAuthRefreshSuccessAction(credentials) {
- return { type: constants.API_AUTH_REFRESH_REQUEST_SUCCESS, credentials };
- }
- export function apiAuthRefreshFailureAction(error) {
- return { type: constants.API_AUTH_REFRESH_REQUEST_FAILURE, error };
- }
- // Generic action for auth updates
- export function authUpdatedAction(credentials, refreshToken) {
- return { type: constants.API_AUTH_UPDATED, credentials, refreshToken };
- }
- // GET auth
- export function apiIdentityRequestAction() {
- return { type: constants.API_IDENTITY_REQUEST };
- }
- export function apiIdentityRequestSuccessAction(identity) {
- return { type: constants.API_IDENTITY_REQUEST_SUCCESS, identity };
- }
- export function apiIdentityRequestFailureAction(error) {
- return { type: constants.API_IDENTITY_REQUEST_FAILURE, error };
- }
- // GET user
- export function apiUserRequestAction(options) {
- return { type: constants.API_USER_REQUEST, options };
- }
- export function apiUserRequestSuccessAction(user) {
- return { type: constants.API_USER_REQUEST_SUCCESS, user };
- }
- export function apiUserRequestFailureAction(error) {
- return { type: constants.API_USER_REQUEST_FAILURE, error };
- }
- // DELETE user
- export function apiUserDeleteRequestAction(username) {
- return { type: constants.API_USER_DELETE_REQUEST, username };
- }
- export function apiUserDeleteRequestSuccessAction() {
- return { type: constants.API_USER_DELETE_REQUEST_SUCCESS };
- }
- export function apiUserDeleteRequestFailureAction(error) {
- return { type: constants.API_USER_DELETE_REQUEST_FAILURE, error };
- }
Add Comment
Please, Sign In to add comment