fix: page config type

This commit is contained in:
shuilan.cj 2022-03-22 10:30:14 +08:00 committed by ClarkXia
parent fc21fd912f
commit 1d16997af8
4 changed files with 18 additions and 24 deletions

View File

@ -1,23 +1,12 @@
import * as React from 'react';
<<<<<<< HEAD
import { useAppContext } from 'ice';
import './home.css';
export default function About() {
const appContext = useAppContext();
console.log('About Page: appContext', appContext);
return <><h2>About Page</h2></>;
}
=======
import { Link } from 'ice';
export default function About() {
return <><h2>About Page</h2><Link to="/">home</Link></>;
}
About.pageConfig = {
auth: ['guest'],
};
>>>>>>> 1d93732c... feat: router (#28)
export function getPageConfig() {
return {
auth: ['guest'],
};
}

View File

@ -14,9 +14,6 @@ export function getPageConfig() {
scripts: [
{ src: 'https://g.alicdn.com/alilog/mlog/aplus_v2.js', block: true },
],
auth: ['admin'],
};
}
Home.pageConfig = {
auth: ['admin'],
};
}

View File

@ -1,9 +1,9 @@
import * as React from 'react';
import type { PageConfig, PageAssets } from './types';
interface DocumentContext {
html?: string;
pageAssets?: any;
pageConfig?: any;
pageAssets?: PageAssets;
pageConfig?: PageConfig;
}
const Context = React.createContext<DocumentContext>(null);

View File

@ -48,9 +48,17 @@ export interface RouteMatch<RouteItem> {
export interface PageConfig {
title?: string;
meta?: any[];
links?: any[];
scripts?: any[];
auth?: string[];
}
export interface PageAssets {
links?: any[];
scripts?: any[];
}
export type PageWrapper<InjectProps> = (<Props>(Component: ComponentType<Props & InjectProps>) => ComponentType<Props>);
export type SetAppRouter = (AppRouter: ComponentType<AppRouterProps>) => void;
export type AddProvider = (Provider: ComponentType) => void;