-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a807c3
commit 846f89c
Showing
5 changed files
with
87 additions
and
53 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,18 +61,27 @@ export const ProjectRegistrationUIActions: () => RegistrationUIActions = () => ( | |
requestRegistrationCode: async (email: string): Promise<string> => { | ||
await sleep(800); | ||
if (isRandomFailure()) { | ||
throw new Error('Sorry, there was a problem sending your request.'); | ||
// throw new Error('Sorry, there was a problem sending your request.'); | ||
} | ||
return 'a1b2c3'; | ||
throw new Error('', { | ||
cause: { | ||
errorMessage: 'ERROR_MESSAGE.EMAIL_ERROR_MESSAGE', | ||
errorOptions: { email: email }, | ||
title: 'ERROR_MESSAGE.EMAIL_ERROR_TITLE', | ||
titleOptions: {timestamp: Date.now()}, | ||
|
||
} | ||
}); | ||
return 'a1b2c3'; | ||
}, | ||
|
||
createPassword: async (password: string): Promise<boolean> => { | ||
await sleep(800); | ||
if (isRandomFailure()) { | ||
throw new Error('Sorry, there was a problem sending your request.'); | ||
} | ||
return true; | ||
}, | ||
createPassword: async (password: string): Promise<boolean> => { | ||
await sleep(800); | ||
if (isRandomFailure()) { | ||
throw new Error('Sorry, there was a problem sending your request.'); | ||
} | ||
return true; | ||
}, | ||
|
||
setAccountDetails: async (details: AccountDetails): Promise<boolean> => { | ||
await sleep(800); | ||
|
@@ -82,37 +91,37 @@ export const ProjectRegistrationUIActions: () => RegistrationUIActions = () => ( | |
return true; | ||
}, | ||
|
||
/** | ||
* The user has tapped on an email link inviting them to register with the application. | ||
* The application should validate the code provided by the link. | ||
* | ||
* @param validationCode Registration code provided from the link. | ||
* @param validationEmail Email provided from the invitation email link (optional) `?email=addr%40domain.com`. | ||
* | ||
* @returns Resolves when the code is valid. True if registration is complete, False if account information is needed. | ||
* If the code is not valid a rejection will occur with an error message. | ||
*/ | ||
validateUserRegistrationRequest: async ( | ||
validationCode: string, | ||
validationEmail?: string | ||
): Promise<{ codeValid: boolean | string; accountExists?: boolean }> => { | ||
await sleep(800); | ||
|
||
if (isRandomFailure()) { | ||
throw new Error('Sorry, there was a problem sending your request.'); | ||
} | ||
return { codeValid: true, accountExists: false }; | ||
}, | ||
|
||
completeRegistration: async (userData: object): Promise<{ email: string; organizationName: string }> => { | ||
const email = '[email protected]'; | ||
const organizationName = 'Acme Co.'; | ||
const userInfo = { email, organizationName }; | ||
|
||
await sleep(1000); | ||
if (isRandomFailure()) { | ||
throw new Error('Sorry, there was a problem sending your request.'); | ||
} | ||
return userInfo; | ||
}, | ||
/** | ||
* The user has tapped on an email link inviting them to register with the application. | ||
* The application should validate the code provided by the link. | ||
* | ||
* @param validationCode Registration code provided from the link. | ||
* @param validationEmail Email provided from the invitation email link (optional) `?email=addr%40domain.com`. | ||
* | ||
* @returns Resolves when the code is valid. True if registration is complete, False if account information is needed. | ||
* If the code is not valid a rejection will occur with an error message. | ||
*/ | ||
validateUserRegistrationRequest: async ( | ||
validationCode: string, | ||
validationEmail?: string | ||
): Promise<{ codeValid: boolean | string; accountExists?: boolean }> => { | ||
await sleep(800); | ||
|
||
if (isRandomFailure()) { | ||
throw new Error('Sorry, there was a problem sending your request.'); | ||
} | ||
return { codeValid: true, accountExists: false }; | ||
}, | ||
|
||
completeRegistration: async (userData: object): Promise<{ email: string; organizationName: string }> => { | ||
const email = '[email protected]'; | ||
const organizationName = 'Acme Co.'; | ||
const userInfo = { email, organizationName }; | ||
|
||
await sleep(1000); | ||
if (isRandomFailure()) { | ||
throw new Error('Sorry, there was a problem sending your request.'); | ||
} | ||
return userInfo; | ||
}, | ||
}); |
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
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
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
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