Prerequisites
🚀 Feature Proposal
The documentation describes the isSaved() function, and this is implemented in the plugin. The types for this are currently not included
Motivation
Enable usage in Typescript of the isSaved function without additional project configuration.
Example
A request is made that depends on new session information being in the datastore, and the datastore has constraints on a new field added by a custom SessionStore:
fastify.post('/myroute', async function(req, rep) {
const someRes = await checkSomething(req.body.val);
if(someRes.doUpdate) {
if(!req.session.isSaved()) {
await req.session.save();
}
await dbOpThatDependsOnSessionTable(someRes);
}
rep.status(200).send()
});
Prerequisites
🚀 Feature Proposal
The documentation describes the
isSaved()function, and this is implemented in the plugin. The types for this are currently not includedMotivation
Enable usage in Typescript of the
isSavedfunction without additional project configuration.Example
A request is made that depends on new session information being in the datastore, and the datastore has constraints on a new field added by a custom
SessionStore: