Move logic to vm

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-08-19 20:35:07 +05:30
parent 068fba3616
commit daf7af17b1
2 changed files with 2 additions and 1 deletions

View file

@ -41,6 +41,7 @@ export class LoginViewModel extends ViewModel {
get completeSSOLoginViewModel(){ return this._completeSSOLoginViewModel; } get completeSSOLoginViewModel(){ return this._completeSSOLoginViewModel; }
get defaultHomeServer() { return this._homeserver; } get defaultHomeServer() { return this._homeserver; }
get errorMessage() { return this._errorMessage; } get errorMessage() { return this._errorMessage; }
get showHomeserver() { return !this._completeSSOLoginViewModel; }
async _createViewModels(homeserver) { async _createViewModels(homeserver) {
if (this._loginToken) { if (this._loginToken) {

View file

@ -33,7 +33,7 @@ export class LoginView extends TemplateView {
t.div({className: "logo"}), t.div({className: "logo"}),
t.h1([vm.i18n`Sign In`]), t.h1([vm.i18n`Sign In`]),
t.mapView(vm => vm.completeSSOLoginViewModel, vm => vm ? new CompleteSSOView(vm) : null), t.mapView(vm => vm.completeSSOLoginViewModel, vm => vm ? new CompleteSSOView(vm) : null),
t.if(vm => !vm.completeSSOLoginViewModel, t.if(vm => vm.showHomeserver,
(t, vm) => t.div({ className: "LoginView_sso form form-row" }, [t.label({ for: "homeserver" }, vm.i18n`Homeserver`), homeserver])), (t, vm) => t.div({ className: "LoginView_sso form form-row" }, [t.label({ for: "homeserver" }, vm.i18n`Homeserver`), homeserver])),
t.mapView(vm => vm.passwordLoginViewModel, vm => vm ? new PasswordLoginView(vm): null), t.mapView(vm => vm.passwordLoginViewModel, vm => vm ? new PasswordLoginView(vm): null),
t.if(vm => vm.passwordLoginViewModel && vm.startSSOLoginViewModel, t => t.p({className: "LoginView_separator"}, vm.i18n`or`)), t.if(vm => vm.passwordLoginViewModel && vm.startSSOLoginViewModel, t => t.p({className: "LoginView_separator"}, vm.i18n`or`)),