fix node editing

This commit is contained in:
Serhii 2023-03-30 18:39:43 +03:00
parent 045852ec4d
commit 1ff4b9bf88
2 changed files with 12 additions and 8 deletions

View file

@ -22,8 +22,8 @@ class NodeForm extends StatelessWidget {
nodeViewModel
..setAddress((editingNode!.uri.host.toString()))
..setPort((editingNode!.uri.port.toString()))
..setPassword((editingNode!.password.toString()))
..setLogin((editingNode!.login.toString()))
..setPassword((editingNode?.password ?? ''))
..setLogin((editingNode?.login ?? ''))
..setSSL((editingNode!.isSSL))
..setTrusted((editingNode!.trusted));
}

View file

@ -98,16 +98,20 @@ abstract class NodeCreateOrEditViewModelBase with Store {
@action
Future<void> save({Node? editingNode, bool saveAsCurrent = false}) async {
final node = Node(
uri: uri,
type: _walletType,
login: login,
password: password,
useSSL: useSSL,
trusted: trusted);
try {
state = IsExecutingState();
if (editingNode != null) {
await _nodeSource.delete(editingNode.key);
await _nodeSource.put(editingNode.key, node);
} else {
await _nodeSource.add(node);
}
final node =
Node(uri: uri, type: _walletType, login: login, password: password,
useSSL: useSSL, trusted: trusted);
await _nodeSource.add(node);
if (saveAsCurrent) {
_settingsStore.nodes[_walletType] = node;
}