create table
This commit is contained in:
@@ -44,6 +44,38 @@ class TableRemoteDataProvider {
|
||||
}
|
||||
}
|
||||
|
||||
Future<DC<TableFailure, TableDto>> storeTable({
|
||||
required String outletId,
|
||||
required String name,
|
||||
required int capacity,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _apiClient.post(
|
||||
ApiPath.tables,
|
||||
data: {
|
||||
'outlet_id': outletId,
|
||||
'table_name': name,
|
||||
'capacity': capacity,
|
||||
'position_x': 200,
|
||||
'position_y': 200,
|
||||
},
|
||||
headers: getAuthorizationHeader(),
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
return DC.error(TableFailure.unexpectedError());
|
||||
}
|
||||
|
||||
final table = TableDto.fromJson(
|
||||
response.data['data'] as Map<String, dynamic>,
|
||||
);
|
||||
return DC.data(table);
|
||||
} on ApiFailure catch (e, s) {
|
||||
log('storeTableError', name: _logName, error: e, stackTrace: s);
|
||||
return DC.error(TableFailure.serverError(e));
|
||||
}
|
||||
}
|
||||
|
||||
Future<DC<TableFailure, TableDto>> updatePosition({
|
||||
required String id,
|
||||
required Offset position,
|
||||
|
||||
Reference in New Issue
Block a user