THT is in early Beta. We welcome contributors & feedback.

Session.getFlash

Session.getFlash(key, default = '')

Description

Retrieve the one-time value of the given key set via Session.setFlash().

The value will then be removed from the session.

If the key does not yet exist, the default value is returned.

// (after processing user action)

Session.setFlash('message', 'Congratulations!');


// ... in the NEXT request only ...

// In HTML template
:: if (Session.hasFlash('message')) {
    <div>{{ Session.getFlash('message') }}</div>
:: }

//= <div>Congratulations!</div>