How to call default API endpoint in custom plugin?

@jarmo how did you exactly solve it ?
I am having the same issue and same problem:
I am logged-in in the admin ui of Strapi as superadmin.
My plugin is making one api call to /api/data route (which is a normal custom controller under src/api/data)

I get always 401 and logged-out…

  const { get } = getFetchClient();
  const response = await get('/api/data');

my routes/data.ts is:

export default {
    routes: [
        {
            method: 'GET',
            path: '/data',
            handler: 'datat.get',
            config: {
                policies: [],
                middlewares: [],
            },
        },
    ],
};

Do I need to add some middleware or policy or what should I change to get this working?