Guest User

Untitled

a guest
Jan 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. /**
  2. * Api actions
  3. */
  4.  
  5. import * as constants from './constants.api';
  6.  
  7. // POST auth
  8. export function apiAuthCredentialsStartAction(credentials) {
  9. return { type: constants.API_AUTH_CREDENTIALS_REQUEST_SUCCESS, credentials };
  10. }
  11.  
  12. export function apiAuthCredentialsSuccessAction(credentials) {
  13. return { type: constants.API_AUTH_CREDENTIALS_REQUEST_SUCCESS, credentials };
  14. }
  15.  
  16. export function apiAuthCredentialsFailureAction(error) {
  17. return { type: constants.API_AUTH_CREDENTIALS_REQUEST_FAILURE, error };
  18. }
  19.  
  20. // POST authGoogle
  21. export function apiAuthGoogleStartAction(googleCredentials) {
  22. return { type: constants.API_AUTH_GOOGLE_REQUEST, credentials: googleCredentials };
  23. }
  24.  
  25. export function apiAuthGoogleSuccessAction(credentials) {
  26. return { type: constants.API_AUTH_GOOGLE_REQUEST_SUCCESS, credentials };
  27. }
  28.  
  29. export function apiAuthGoogleFailureAction(error) {
  30. return { type: constants.API_AUTH_GOOGLE_REQUEST_FAILURE, error };
  31. }
  32.  
  33. // POST authRefresh
  34. export function apiAuthRefreshStartAction(refreshToken) {
  35. return { type: constants.API_AUTH_REFRESH_REQUEST, refreshToken };
  36. }
  37.  
  38. export function apiAuthRefreshSuccessAction(credentials) {
  39. return { type: constants.API_AUTH_REFRESH_REQUEST_SUCCESS, credentials };
  40. }
  41.  
  42. export function apiAuthRefreshFailureAction(error) {
  43. return { type: constants.API_AUTH_REFRESH_REQUEST_FAILURE, error };
  44. }
  45.  
  46. // Generic action for auth updates
  47. export function authUpdatedAction(credentials, refreshToken) {
  48. return { type: constants.API_AUTH_UPDATED, credentials, refreshToken };
  49. }
  50.  
  51. // GET auth
  52. export function apiIdentityRequestAction() {
  53. return { type: constants.API_IDENTITY_REQUEST };
  54. }
  55.  
  56. export function apiIdentityRequestSuccessAction(identity) {
  57. return { type: constants.API_IDENTITY_REQUEST_SUCCESS, identity };
  58. }
  59.  
  60. export function apiIdentityRequestFailureAction(error) {
  61. return { type: constants.API_IDENTITY_REQUEST_FAILURE, error };
  62. }
  63.  
  64. // GET user
  65. export function apiUserRequestAction(options) {
  66. return { type: constants.API_USER_REQUEST, options };
  67. }
  68.  
  69. export function apiUserRequestSuccessAction(user) {
  70. return { type: constants.API_USER_REQUEST_SUCCESS, user };
  71. }
  72.  
  73. export function apiUserRequestFailureAction(error) {
  74. return { type: constants.API_USER_REQUEST_FAILURE, error };
  75. }
  76.  
  77. // DELETE user
  78. export function apiUserDeleteRequestAction(username) {
  79. return { type: constants.API_USER_DELETE_REQUEST, username };
  80. }
  81.  
  82. export function apiUserDeleteRequestSuccessAction() {
  83. return { type: constants.API_USER_DELETE_REQUEST_SUCCESS };
  84. }
  85.  
  86. export function apiUserDeleteRequestFailureAction(error) {
  87. return { type: constants.API_USER_DELETE_REQUEST_FAILURE, error };
  88. }
Add Comment
Please, Sign In to add comment