step 17 : proteksi presensi selfie button clock in & clock out

This commit is contained in:
sindhu
2024-01-27 18:36:07 +07:00
parent 79c0729979
commit 84057f32b0
4 changed files with 113 additions and 69 deletions

View File

@@ -18,7 +18,16 @@ abstract class BaseRepository {
final QueryResult result = await graphql.mutate(options);
if (result.hasException) {
throw BaseRepositoryException(message: result.exception.toString());
// throw BaseRepositoryException(message: result.exception.toString());
if (result.exception != null) {
if (result.exception!.graphqlErrors.isNotEmpty) {
String error = "";
if (result.exception!.graphqlErrors[0].message != "") {
error += result.exception!.graphqlErrors[0].message;
throw BaseRepositoryException(message: error);
}
}
}
}
// return result.data!;
@@ -36,9 +45,20 @@ abstract class BaseRepository {
final QueryResult result = await graphql.query(options);
if (result.hasException) {
throw BaseRepositoryException(message: result.exception.toString());
// throw BaseRepositoryException(message: result.exception.toString());
if (result.exception != null) {
if (result.exception!.graphqlErrors.isNotEmpty) {
if (result.exception!.graphqlErrors[0].message != "") {
throw BaseRepositoryException(
message: result.exception!.graphqlErrors[0].message.toString(),
);
}
}
}
}
// throw BaseRepositoryException(message: result.exception.toString());
return result.data!;
} catch (e) {
throw BaseRepositoryException(message: e.toString());