Feat: Welcome Page (#17150)
This commit is contained in:
committed by
mrugesh mohapatra
parent
47bb4ca5e3
commit
156ea1af76
@@ -4,7 +4,6 @@ import {
|
||||
ifNoUser401,
|
||||
createValidatorErrorHandler
|
||||
} from '../utils/middleware';
|
||||
import supportedLanguages from '../../common/utils/supported-languages.js';
|
||||
import { themes } from '../../common/utils/themes.js';
|
||||
import { alertTypes } from '../../common/utils/flash.js';
|
||||
|
||||
@@ -48,29 +47,6 @@ export default function settingsController(app) {
|
||||
);
|
||||
}
|
||||
|
||||
function updateMyLang(req, res, next) {
|
||||
const { user, body: { lang } = {} } = req;
|
||||
const langName = supportedLanguages[lang];
|
||||
const update = { languageTag: lang };
|
||||
if (!supportedLanguages[lang]) {
|
||||
return res.json({
|
||||
message: `${lang} is currently unsupported`
|
||||
});
|
||||
}
|
||||
if (user.languageTag === lang) {
|
||||
return res.json({
|
||||
message: `Your language is already set to ${langName}`
|
||||
});
|
||||
}
|
||||
return user.update$(update)
|
||||
.subscribe(
|
||||
() => res.json({
|
||||
message: `Your language has been updated to '${langName}'`
|
||||
}),
|
||||
next
|
||||
);
|
||||
}
|
||||
|
||||
const updateMyCurrentChallengeValidators = [
|
||||
check('currentChallengeId')
|
||||
.isMongoId()
|
||||
@@ -183,11 +159,6 @@ export default function settingsController(app) {
|
||||
createValidatorErrorHandler(alertTypes.danger),
|
||||
updateMyCurrentChallenge
|
||||
);
|
||||
api.post(
|
||||
'/update-my-lang',
|
||||
ifNoUser401,
|
||||
updateMyLang
|
||||
);
|
||||
api.post(
|
||||
'/update-my-portfolio',
|
||||
ifNoUser401,
|
||||
|
Reference in New Issue
Block a user