Guest User

Untitled

a guest
Feb 14th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. interface LoginData {
  2. email: string;
  3. password: string;
  4. }
  5.  
  6. export interface UserData {
  7. id: string;
  8. email: string;
  9. profilePicture: string;
  10. }
  11.  
  12. export type LoginAction =
  13. | { type: 'LOGIN_REQUEST'; input: LoginData }
  14. | { type: 'LOGIN_SUCCESS'; user: UserData }
  15. | { type: 'LOGIN_FAILED'; error: string };
  16.  
  17. // action creators
  18. export function loginRequest(input: LoginData): LoginAction {
  19. return { type: 'LOGIN_REQUEST', input };
  20. }
  21.  
  22. export function loginSuccess(user: UserData): LoginAction {
  23. return { type: 'LOGIN_SUCCESS', user };
  24. }
  25.  
  26. export function loginFailed(error: string): LoginAction {
  27. return { type: 'LOGIN_FAILED', error };
  28. }
Add Comment
Please, Sign In to add comment