UNPKG

stackpress

Version:

Incept is a content management framework.

41 lines (40 loc) 1.4 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ServerProvider; const jsx_runtime_1 = require("react/jsx-runtime"); const Request_1 = require("@stackpress/lib/Request"); const ServerContext_js_1 = __importDefault(require("./ServerContext.js")); function ServerProvider(props) { const unknownHost = new URL((0, Request_1.withUnknownHost)('/')); const { data = {}, session = { id: '', name: 'Guest', roles: ['GUEST'], token: '', permits: [] }, request = { url: { hash: unknownHost.hash, host: unknownHost.host, hostname: unknownHost.hostname, href: unknownHost.href, origin: unknownHost.origin, pathname: unknownHost.pathname, port: unknownHost.port, protocol: unknownHost.protocol, search: unknownHost.search }, headers: {}, session: {}, method: 'GET', mime: '', data: {} }, response = { code: 0, status: '' }, children } = props; return ((0, jsx_runtime_1.jsx)(ServerContext_js_1.default.Provider, { value: { data, session, request, response }, children: children })); }