UNPKG

piral-auth

Version:

Plugin for handling authentication in Piral.

20 lines 526 B
import * as actions from './actions'; /** * Creates new Pilet API extensions for enabling authentication support. */ export function createAuthApi(config = {}) { const { user } = config; return (context) => { context.defineActions(actions); context.dispatch((state) => ({ ...state, user, })); return { getUser() { return context.readState((state) => state.user); }, }; }; } //# sourceMappingURL=create.js.map