Remove server url awareness from LoginForm making it a cleaner component.

master
Tom Hacohen 7 years ago
parent 9f5da61dfb
commit e710e89200

@ -26,7 +26,7 @@ class LoginForm extends React.PureComponent {
}; };
props: { props: {
onSubmit: (username: string, password: string, encryptionPassword: string, serviceApiUrl: string) => void; onSubmit: (username: string, password: string, encryptionPassword: string, serviceApiUrl?: string) => void;
loading?: boolean; loading?: boolean;
error?: Error; error?: Error;
}; };
@ -55,7 +55,7 @@ class LoginForm extends React.PureComponent {
generateEncryption(e: any) { generateEncryption(e: any) {
e.preventDefault(); e.preventDefault();
const server = this.state.showAdvanced ? this.state.server : C.serviceApiBase; const server = this.state.showAdvanced ? this.state.server : undefined;
const username = this.state.username; const username = this.state.username;
const password = this.state.password; const password = this.state.password;

@ -21,7 +21,8 @@ class Root extends React.PureComponent {
this.onFormSubmit = this.onFormSubmit.bind(this); this.onFormSubmit = this.onFormSubmit.bind(this);
} }
onFormSubmit(username: string, password: string, encryptionPassword: string, serviceApiUrl: string) { onFormSubmit(username: string, password: string, encryptionPassword: string, serviceApiUrl?: string) {
serviceApiUrl = serviceApiUrl ? serviceApiUrl : C.serviceApiBase;
store.dispatch(fetchCredentials(username, password, encryptionPassword, serviceApiUrl)); store.dispatch(fetchCredentials(username, password, encryptionPassword, serviceApiUrl));
} }

Loading…
Cancel
Save