routing
This commit is contained in:
parent
76bbdbfb61
commit
098e0fe1da
@ -8,8 +8,9 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
navigations: {
|
navigations: {
|
||||||
'undefined.main': '/undefined',
|
'enter.main': '/enter',
|
||||||
'link.undefined.auth': '/auth'
|
'link.enter.auth': '/auth',
|
||||||
|
'link.enter.account': '/account',
|
||||||
},
|
},
|
||||||
features: {
|
features: {
|
||||||
'undefined': {
|
'undefined': {
|
||||||
|
@ -15,5 +15,6 @@
|
|||||||
"build": "npm run clean && ijl-cli build --dev",
|
"build": "npm run clean && ijl-cli build --dev",
|
||||||
"build:prod": "npm run clean && ijl-cli build",
|
"build:prod": "npm run clean && ijl-cli build",
|
||||||
"clean": "rimraf dist"
|
"clean": "rimraf dist"
|
||||||
}
|
},
|
||||||
|
"name": "enter"
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
import { getNavigations, getNavigationsValue } from '@ijl/cli';
|
import { getNavigations, getNavigationsValue } from '@ijl/cli';
|
||||||
import pkg from '../../package.json';
|
import pkg from '../../package.json';
|
||||||
|
|
||||||
const baseUrl = getNavigationsValue(`${pkg.name}.main`);
|
const baseUrl = getNavigationsValue(`${(pkg as any).name}.main`);
|
||||||
const navs = getNavigations();
|
const navs = getNavigations();
|
||||||
const makeUrl = url => baseUrl + url;
|
const makeUrl = url => baseUrl + url;
|
||||||
|
|
||||||
export const URLs = {
|
export const URLs = {
|
||||||
baseUrl,
|
baseUrl,
|
||||||
auth: {
|
auth: {
|
||||||
url: makeUrl(navs[`link.${pkg.name}.auth`]),
|
url: makeUrl(navs[`link.${(pkg as any).name}.auth`]),
|
||||||
},
|
},
|
||||||
|
account: {
|
||||||
|
url: makeUrl(navs[`link.${(pkg as any).name}.account`]),
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -3,16 +3,16 @@ import { Routes, Route, Navigate } from 'react-router-dom';
|
|||||||
|
|
||||||
import { URLs } from './__data__/urls';
|
import { URLs } from './__data__/urls';
|
||||||
|
|
||||||
const Hello = () => <h1>Hello</h1>;
|
import HomePage from './pages/HomePage.jsx'
|
||||||
|
import Hello from './pages/Hello.jsx'
|
||||||
|
import Account from './pages/Account.jsx'
|
||||||
|
|
||||||
export const Dashboard = () => {
|
export const Dashboard = () => {
|
||||||
return (
|
return (
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route
|
<Route path={URLs.baseUrl} element={<HomePage/>}/>
|
||||||
path={URLs.baseUrl}
|
|
||||||
element={<Navigate replace to={URLs.auth.url} />}
|
|
||||||
/>
|
|
||||||
<Route path={URLs.auth.url} element={<Hello/>} />
|
<Route path={URLs.auth.url} element={<Hello/>} />
|
||||||
|
<Route path={URLs.account.url} element={<Account/>}/>
|
||||||
</Routes>
|
</Routes>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
9
src/pages/Account.jsx
Normal file
9
src/pages/Account.jsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const Account = () => {
|
||||||
|
return (
|
||||||
|
<h1>Account</h1>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Account;
|
9
src/pages/Hello.jsx
Normal file
9
src/pages/Hello.jsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const Hello = () => {
|
||||||
|
return (
|
||||||
|
<h1>Hello!</h1>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Hello;
|
9
src/pages/HomePage.jsx
Normal file
9
src/pages/HomePage.jsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const HomePage = () => {
|
||||||
|
return (
|
||||||
|
<h1>Home</h1>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomePage
|
Loading…
Reference in New Issue
Block a user