I have a very silly problem, can someone tell me how to assign the outer variable, the data from an async function in the following code

    let data1;

    const handleGetServices = async () => {
    const resp = await getServiceConf({ doctorId: oid });
    const { success, data } = resp;
    data1 = data;
   }
   console.log(data1) // it is coming undefined

 

why is it undefined, how can I achieve what i want…and assign the value of data to data1(the outer variable) here