delete method
Future<void>
delete(
- String id, {
- Map<
String, dynamic> body = const {}, - Map<
String, dynamic> query = const {}, - Map<
String, String> headers = const {},
override
Deletes a single admin model by its id.
If the current AuthStore.model matches with the deleted id, then on success the client AuthStore will be also cleared.
Implementation
@override
Future<void> delete(
String id, {
Map<String, dynamic> body = const {},
Map<String, dynamic> query = const {},
Map<String, String> headers = const {},
}) {
return super
.delete(
id,
body: body,
query: query,
headers: headers,
)
.then((_) {
if (client.authStore.model != null &&
client.authStore.model is AdminModel &&
(client.authStore.model as AdminModel).id == id) {
client.authStore.clear();
}
return;
});
}