Hooks
sanctum:refresh
Subscribe to refresh hook to inject custom event handling
Usage
When the authentication state changes (e.g. onLogin, onLogout), the module has to refresh the user identity.
Subscribe to the sanctum:refresh hook which triggers once the identity refresh request is completed.
app/plugins/sanctum-listener.ts
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('sanctum:refresh', () => {
console.log('Sanctum refresh hook triggered')
})
})
Here is what the hook looks like
interface RuntimeNuxtHooks {
/**
* Triggers when user identity has been refreshed.
*/
'sanctum:refresh': () => HookResult
}