0

I have something like :

    const isInvited = async (user) => {
        const res = await axios.get(url(`/api/invite/isInvited?target_user_id=${user.pk}`), {
            headers: {
                "auth-token": authToken,
            }
        });

        return res.data;

    }

    const searchPeoples = async e => {
        e.preventDefault();

        const query = e.target.querySelector("#query").value;

        setSearching(true);
        const res = await axios.get(url(`/api/user/search/?query=${query}`));
        const found = await res.data.map(async item => {
            const is_Invited = await isInvited(item);
            return { ...item, is_Invited }
        });

        setSearching(false);
        console.log(found)

        setFoundPeoples([]);

    };

But when I see the console, the value of found (var) equals to a Promise object, But I want to see the data of response that the isInvited function returns. I am working on a project but this problem is stopping me to complete my project. Please help me to fix this problem.

0 Answers0