I am looking to enhance my app by dynamically displaying pages based on a user's type and role properties. Currently, I am using a simple switch statement that determines the view based on the user's type, like this:
switch(type) {
case 'a':
return CONSTANT.ONE;
case 'b':
return CONSTANT.TWO;
default:
return null;
}
While this switch statement works for now, it is not ideal for scalability as the number of types and roles increases. Can anyone recommend a more effective pattern to handle this scenario? I considered using a state pattern, but I am unsure if that is too complex for simply returning a string. Any suggestions would be greatly appreciated.
Thank you.