Get Task assignee when clicking 'Complete'

Hi there,

I’m trying to save the task assignee once the task is completed.
Below the code:

async function get_assignee(){
  const response = await fetch("https://url/camunda/api/engine/engine/default/task/" + camForm.taskId);
  const json = await response.json();
  return json.assignee;
};
camForm.on('submit', function () {
  var assignee = get_assignee();
  console.log(assignee);
  camForm.variableManager.variableValue('spot_check_assignee', assignee);
  camForm.variableManager.variableValue('status', $scope.status_selected);
});

I’ve noticed a weird behavior once i click on ‘Complete’.
debugging the variable i’ve noticed that json.assignee contains the correct value, but the function get_assignee never return. it is like running twice and then the code is like hanging into an infinite loop, the button gets disabled, and the task is not completed.

Any hint here

For those interested:
the reliable way to get the information is was looking for, is the following:

<script cam-script type="text/text/form-script">
inject(['$rootScope', function($rootScope) {
      $scope.userName = $rootScope.authentication.name;
    }]);
</script>