Starter
This commit is contained in:
parent
40b4f7ba11
commit
8d99bdb724
|
|
@ -188,7 +188,7 @@ else
|
|||
sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_state.dart
|
||||
|
||||
comment="STARTER: state getters - do not remove comment"
|
||||
code="${Module}State get ${module}State => this.dataState.${module}State;${lineBreak}"
|
||||
code="${Module}State get ${module}State => selectedCompanyState.${module}State;${lineBreak}"
|
||||
code="${code}ListUIState get ${module}ListState => this.uiState.${module}UIState.listUIState;${lineBreak}"
|
||||
code="${code}${Module}UIState get ${module}UIState => this.uiState.${module}UIState;${lineBreak}${lineBreak}"
|
||||
sed -i -e "s/$comment/$comment${lineBreak}$code/g" ./lib/redux/app/app_state.dart
|
||||
|
|
|
|||
|
|
@ -40,4 +40,23 @@ class StubRepository {
|
|||
|
||||
return stubResponse.data;
|
||||
}
|
||||
|
||||
Future<StubEntity> saveData(
|
||||
CompanyEntity company, AuthState auth, StubEntity stub,
|
||||
[EntityAction action]) async {
|
||||
final data = serializers.serializeWith(StubEntity.serializer, stub);
|
||||
dynamic response;
|
||||
|
||||
if (stub.isNew) {
|
||||
response = await webClient.post(
|
||||
auth.url + '/stubs',
|
||||
company.token,
|
||||
json.encode(data));
|
||||
} else {
|
||||
var url = auth.url + '/stubs/' + stub.id.toString();
|
||||
if (action != null) {
|
||||
url += '?action=' + action.toString();
|
||||
}
|
||||
response = await webClient.put(url, company.token, json.encode(data));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue