Skip to content

Instantly share code, notes, and snippets.

@maxp
Last active August 23, 2017 14:09
Show Gist options
  • Save maxp/2ae854067d8f4110851bdc68889f5ab9 to your computer and use it in GitHub Desktop.
Save maxp/2ae854067d8f4110851bdc68889f5ab9 to your computer and use it in GitHub Desktop.
;; 1
(defn resend-code [email on-success on-error]
(let [cognito_user (new CognitoUser #js {:Username email :Pool config/user_pool})]
(.resendConfirmationCode cognito_user
(fn [err result]
(info! "cognito.resend-code:" err result
(if err
(on-error err)
(on-success result)))))))
;; 2
(defn resend-code [email on-success on-error]
(let [cognito_user (new CognitoUser #js {:Username email :Pool config/user_pool})]
(.resendConfirmationCode cognito_user
(fn [err result]
(info! "cognito.resend-code:" err result
(if err
(on-error err)
(on-success result)))))))
;; 3
(defn resend-code [email on-success on-error]
(let [cognito_user (new CognitoUser #js {:Username email :Pool config/user_pool})]
(.resendConfirmationCode cognito_user
(fn [err result]
(info! "cognito.resend-code:" err result
(if err
(on-error err)
(on-success result)))))))
;; 4
(rf/reg-event-fx :user.cognito/login
(fn [{db :db} [_ login password]]
(let [cognito_user (new CognitoUser #js {:Username login
:Pool config/user_pool})
auth_details (new AuthenticationDetails #js {:Username login
:Password password})]
;; 5
(rf/reg-event-fx :user.cognito/login
(fn [{db :db} [_ login password]]
(let [cognito_user
(new CognitoUser #js {:Username login :Pool config/user_pool})
auth_details
(new AuthenticationDetails #js {:Username login :Password password})]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment