Adapter in ember

Hi All,

I am stuck at setting host url in adapter. Which of below will not affect the performance ?

Problem- A web page is written in ember which show data from a service depending upon “type of user” , say USER A and USER B.

For USER A , every functionality is up and running. However, for USER B we need show data from another web service(to be implemented-functionality is same).

Question : Can we assign HOST URL in adapter file depending upon type of user ? For example:

if(USER A){ const dummyHost = “xyz.abc” || “ABC”;

} else{ _ const dummyHost = “xyz.pqr” || “PQR”; _

}

_ host: get(globalVar, dummyHost),_

Or should we do it in component ? for that we need to create a need adapter file and mapping it.

Any more suggestion??/

Request you to be more specific on this.

  1. Is type an attribute of ‘user’ model?

  2. Do you use different model classes for different types? e.g. User, AdminUser, TreasuryUser etc. (I am throwing random names here)

Ember allows you to customize adapters on a per model basis and not on per object basis. For your case of customizing things based on the type of user, you may want to create a model hierarchy by creating a base user class, and extend it with specialized types like AdminUser etc. and then create custom adapters to achieve your desired results.