addSecondaryPhone method
Future<Map<String, dynamic> >
addSecondaryPhone({
- required BuildContext context,
- required String? phoneNumber,
Implementation
Future<Map<String, dynamic>> addSecondaryPhone(
{required BuildContext context, required String? phoneNumber}) async {
try {
final http.Response result =
await client.query(addSecondaryPhoneQuery, <String, dynamic>{
'phone': <String?>[phoneNumber],
}) as http.Response;
final Map<String, dynamic> body =
client.toMap(result) as Map<String, dynamic>;
if (client.parseError(body) != null) {
return <String, dynamic>{
'status': 'error',
};
}
/// update user profile with the secondary phone number
updateStateFunc(
context: context,
type: StateContactType.secondaryPhones,
value: phoneNumber);
return <String, dynamic>{
'status': 'ok',
'value': json.decode(result.body)['data']['addSecondaryPhoneNumber'],
};
} catch (e) {
return <String, dynamic>{
'status': 'error',
};
}
}