Move this inside the `if (data !== null && data !== '')` condition.