I\'m trying to create a reusable custom decorator that will contain logic to warn about leaving the page with unsaved data. At the moment I have the following piece of code