Last active
August 23, 2017 14:09
-
-
Save maxp/2ae854067d8f4110851bdc68889f5ab9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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