stackpress
Version:
Incept is a content management framework.
35 lines (34 loc) • 1.09 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { withUnknownHost } from '@stackpress/lib/Request';
import ServerContext from './ServerContext.js';
export default function ServerProvider(props) {
const unknownHost = new URL(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 (_jsx(ServerContext.Provider, { value: { data, session, request, response }, children: children }));
}