번호 자동 부여 대응 및 API 공통 처리 보강
This commit is contained in:
@@ -44,8 +44,7 @@ class VendorRepositoryRemote implements VendorRepository {
|
||||
data: vendorInputToJson(input),
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return VendorDto.fromJson(data).toEntity();
|
||||
return VendorDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -56,8 +55,7 @@ class VendorRepositoryRemote implements VendorRepository {
|
||||
data: payload,
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return VendorDto.fromJson(data).toEntity();
|
||||
return VendorDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -71,7 +69,6 @@ class VendorRepositoryRemote implements VendorRepository {
|
||||
'$_basePath/$id/restore',
|
||||
options: Options(responseType: ResponseType.json),
|
||||
);
|
||||
final data = (response.data?['data'] as Map<String, dynamic>?) ?? {};
|
||||
return VendorDto.fromJson(data).toEntity();
|
||||
return VendorDto.fromJson(_api.unwrapAsMap(response)).toEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ class _VendorEnabledPageState extends State<_VendorEnabledPage> {
|
||||
final currentPage = result?.page ?? 1;
|
||||
final totalPages = result == null || result.pageSize == 0
|
||||
? 1
|
||||
: (result.total / result.pageSize).ceil().clamp(1, 9999) as int;
|
||||
: (result.total / result.pageSize).ceil().clamp(1, 9999);
|
||||
final hasNext = result == null
|
||||
? false
|
||||
: (result.page * result.pageSize) < result.total;
|
||||
@@ -365,7 +365,7 @@ class _VendorEnabledPageState extends State<_VendorEnabledPage> {
|
||||
final result = _controller.result;
|
||||
final totalPages = result == null || result.pageSize == 0
|
||||
? 1
|
||||
: (result.total / result.pageSize).ceil().clamp(1, 9999) as int;
|
||||
: (result.total / result.pageSize).ceil().clamp(1, 9999);
|
||||
if (page < 1) {
|
||||
page = 1;
|
||||
} else if (page > totalPages) {
|
||||
|
||||
Reference in New Issue
Block a user