-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from lgraziani2712/access-level-more-strict
Make the access to exercises more strict
- Loading branch information
Showing
22 changed files
with
386 additions
and
107 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @author Luciano Graziani @lgraziani2712 | ||
* @license {@link http://www.opensource.org/licenses/mit-license.php|MIT License} | ||
* | ||
* @flow | ||
*/ | ||
import swal from 'sweetalert2'; | ||
|
||
import { ONE, THREE } from 'core/constants/numbers'; | ||
import gameTextUI from 'core/constants/localize/es/gameTextUI'; | ||
|
||
/** | ||
* This is in charge of redirect to the next | ||
* exercise in case it exists one. | ||
* If not, it announce the level completeness. | ||
* | ||
* @version 1.0.0 | ||
* @param {string} activityName The activity name. | ||
* @param {string} difficulty The difficulty. | ||
* @param {Object} location The react-router location object. | ||
* @param {Object} history The react-router history object. | ||
* @return {Promise<void>} The sweetalert promise. | ||
*/ | ||
const handleNextLevelRedirection = ( | ||
activityName: string, | ||
difficulty: string, | ||
location: Object, | ||
history: Object, | ||
) => (): Promise<void> => { | ||
const level = parseInt(location.pathname.split('/').pop()); | ||
const stringLvl = (level + ONE).toString().padStart(THREE, '0'); | ||
const path = `/${activityName}/${difficulty}/${stringLvl}`; | ||
|
||
return swal(gameTextUI.successMessage).then(() => { | ||
history.push(path); | ||
}, () => { | ||
history.push(path); | ||
}); | ||
}; | ||
|
||
export default handleNextLevelRedirection; |
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
Oops, something went wrong.