had written the following controller to filter a find request based on relations with an authenticated user. The filter no longer works after updating to Strapi 4.15.5.
I now recieve an error saying the user parameter (the one in the filters) is invalid. Why is this the case, and how can I solve this issue in the new strapi version? Please help my project is on hold because of this - thank you
Controller:
async find(ctx) {
const authorizationHeader = ctx.headers.authorization;
if (!authorizationHeader) {
return ctx.badRequest('Authorization header is required');
}
const [scheme, token] = authorizationHeader.split(' ');
const decodedToken = jwt.jwtDecode(token);
ctx.query = {
filters: {
user: {
id: {
$eq: decodedToken.id
}
}
}
}
const { data, meta } = await super.find(ctx);
return { data, meta}
},
This topic has been created from a Discord post (1214656527542124684) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord