const ongoingTrainingHandler = () => {
console.log('1');
};
const newTrainingHandler = () => {
};
const achievedTrainingHandler = () => {
};
const trainingHandlersByType = {
ongoing: ongoingTrainingHandler,
newer: newTrainingHandler,
failed: achievedTrainingHandler,
achieved: achievedTrainingHandler
};
trainingHandlersByType[status]();
const redirectHandler = (type) => {
return () => {
};
};
const categoryHandlersByType = {
training: this.trainingHandler,
news: this.redirectHandler('article'),
article: this.redirectHandler('article'),
brand: this.redirectHandler('brand'),
range: this.redirectHandler('range'),
product: this.redirectHandler('product'),
glossaryItem: this.glossaryHandler,
downloads: this.downloadsHandler,
acceptedPost: this.redirectHandler('mission-brief'),
mission: () => {
this.showModal({
id: this.model.training
? 'e-learning-modal'
: 'apercu-mission-modal',
config: {
mission: this.model
}
});
}
};
categoryHandlersByType[category]();