Factor out saving cookie to function.
Factor out saving cookie to function.

Saving cookie uses some default security parameters like httpOnly and secure. It
makes sense to set these once and use it throughout the app.

vacuumlabs/doc-viewer