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
// bootstrap.js | |
axios.interceptors.response.use( | |
response => { | |
/** | |
* If the response contains authorization header, | |
* Then we assume that it is from the renew token request. | |
* Set the new JWT token. | |
*/ | |
const authHeader = response.headers.authorization; | |
if (authHeader) jwt.setToken(authHeader.substr(7)); |
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
// Back To Top button | |
var offset = 500; | |
var offsetOpacity = 1500; | |
var scrollDuration = 700; | |
var $backToTop = $('.gh-top'); | |
$(window).scroll(function () { | |
if ($(this).scrollTop() > offset) { | |
$backToTop.addClass('gh-top-visible'); | |
} else { |
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
var $formChoice = $('.gh-form-choice'); | |
$('#typesOfStudy').on('change', function () { | |
var value = $(this).val(); | |
if (value !== '') { | |
var formToShown = '.gh-form-' + value; | |
$formChoice.not(formToShown).slideUp(400, function () { | |
$(formToShown).slideDown(); | |
}); | |
} else { | |
$formChoice.slideUp(); |
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
function getHobbyOf(name) { | |
var hobby = { | |
'Huy': 'Guitar', | |
'Tram': 'Photography', | |
'default': 'Out of survey' | |
}; | |
return hobby[name] || hobby['default']; | |
} | |
getHobbyOf('Huy'); // log 'Guitar' |
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
function getHobbyOf(name) { | |
var hobby; | |
switch (name) { | |
case 'Huy': | |
hobby = 'Guitar'; | |
break; | |
case 'Tram': | |
hobby = 'Photography'; | |
break; | |
default: |