What am I doing wrong. Have simplified this for the example:
Front End:
import {deleteMember} from ‘backend/backendServices’ ;
export function btnRemoveMember_click(event) {
var userId = ‘’
deleteMember(userId)
.then( function (result) {
$w( “#txtTest” ).text = "result: " + result;
})
}
Backend Example A: (DOES NOT RETURN ANYTHING)
export function deleteMember(userId) {
wixUsersBackend.deleteUser(userId)
.then( () => {
return “User has been deleted”
})
. catch ( (err) => {
return JSON.stringify( "User has failed delete attempt!: " + err);
});
}
Backend Example B: (RETURNS/WORKS JUST FINE)
export function deleteMember(userId) {
return “hello”
}
It works fine (I get the return string) when i run a command in the backend that does not have the promise resolution (.then/.catch structure) - Example B . But when I include it as shown above in Example A , the front end does not get the return values. The back-end function executes its task just fine (or not fine in the example above where the userID is null), but the front end does not know what the result is.
I have a feeling this is something really simple that I am overlooking. But rather than sit and stew for any longer, I feel I need to ask for help.
thanks.