#Help deconstructing props

5 messages · Page 1 of 1 (latest)

wise oasis
#

I found out why it was returning it inside props after deconstructing, it was in my api calls

#

export const fetchMutualGuilds = async (context: GetServerSidePropsContext) => {
    const headers = validateCookies(context);
    if (!headers) return { redirect: { destination: "/" } };

    try {
        const { data: guilds } = await axios.get<Guild[]>(`${API_URL}/guilds`, { headers });
        return { guilds };
    } catch (err) {
        console.error(err);
        return { redirect: { destination: "/" } };
    }
};

export const fetchGuild = async (context: GetServerSidePropsContext) => {
    const headers = validateCookies(context);
    if (!headers) return { redirect: { destination: "/" } };

    try {
        const { data: guild } = await axios.get<Guild>(`${API_URL}/guilds/${context.query.id}`, { headers });
        return { guild };
    } catch (err) {
        console.error(err);
        return { redirect: { destination: "/" } };
    }
};```
#

but now its returning inside of 'guilds' or 'guild'

#

i know its returning it as {guild:{guild:{