Looking to extract the email attribute of the current user on my website. Here is a snippet of the code I am working with:
$scope.deleteit = function(data) {
var deletepost = data;
console.log(Auth.currentUser());
// console.log(Auth.currentUser().email) //returns undefined
}
Here is the output reflected in my browser's developer console:
Resource { $promise={...}, $resolved=false, $get=function(), more...}
Upon clicking the above content within the dev console, this information is visible:
$promise
Object { then=function(), catch=function(), finally=function()}
$resolved
true
__v
0
_id
"53c3ef3f8766558e16233dd0"
email
"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="28505050684f45494144064b4745">[email protected]</a>"
name
"xxx"
provider
"local"
role
"user"
$delete
function(params, success, error)
$get
function(params, success, error)
$query
function(params, success, error)
$remove
function(params, success, error)
$save
function(params, success, error)
$update
function(params, success, error)
__proto__
Resource { $get=function(), $save=function(), $query=function(), more...}
Any tips on how to access the email attribute?
Additionally, I am in the process of establishing a method to verify whether the post owner is the one attempting to delete it.