I implemented a gdpr delete action that deletes a record from the user table and some more. After the action finished I want the view to show the native not found screen.
How can I do it?
Please provide any relevant information about your setup.
- Package Version: forest-express-sequelize 7.0.3
- Express Version: 4.17.1
- Sequelize Version: ~5.15.1
- Database Dialect: pg
- Database Version: 9.4
- Forest-Environment-Id: 68385
- Forest-Project-Id: 54928
- Forest-Rendering-Id: 82745
- Forest-Team-Id: 54359
Hi @JonasKman,
Thank you for reaching out!
Well, I am not sure there is a direct refresh solution
Something that comes to my mind that might help you solving this is to redirect on success (here is the documentation about the redirectTo).
Did you consider this option yet?
Yes I considered that option, but wanted to check if there was an automatic solution, since building the correct link is not that easy since the team
is not available to construct the link.
Hi @JonasKman
Here is a small code example that you could use to “redirect” to the native not found page
new RecordsGetter(projects).getIdsFromRequest(req).then((ids) => {
const currentId = ids[0]
res.send({
success: 'Successfully deleted',
redirectTo: `/My%20UrlEncoded%20Project/${process.env.MY_ENVIRONMENT_NAME}/${req.user.team}/data/<collectionName>/index/record/<collectionName>/${currentId}/details`,
});
})
just a small tip, ${req.user.team}
can be used to retrieve the team the user is currently on.
To be able to redirect to the correct environment, you can define your environment name in the .env
file to be able to share this code for all the environments.
By testing this code, I found a small issue on our end, the request will be sent to refresh the data, but the frontend wouldn’t refresh. I am creating a bug report for this. We will let you know once the issue is solved
1 Like