mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
update: dynamic indexer
This commit is contained in:
parent
0316c55374
commit
acbe2adf34
36
src/pages/[page].js
Normal file
36
src/pages/[page].js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import React, { PureComponent } from 'react'
|
||||||
|
import { pathMatchRegexp } from 'core'
|
||||||
|
import Error404 from './404.js'
|
||||||
|
// <UserProfile {...this.props} regx={matchUser} />
|
||||||
|
|
||||||
|
class PageIndexer extends PureComponent {
|
||||||
|
render() {
|
||||||
|
const { location } = this.props
|
||||||
|
const matchUser = pathMatchRegexp('/@:id', location.pathname)
|
||||||
|
const matchSetting = pathMatchRegexp('/~:id', location.pathname)
|
||||||
|
console.log(matchSetting)
|
||||||
|
if (matchUser) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
User, matched => {matchUser}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (matchSetting) {
|
||||||
|
return(
|
||||||
|
<div>
|
||||||
|
Bruh, matched => {matchSetting}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default return Error 404
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Error404 />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PageIndexer
|
Loading…
x
Reference in New Issue
Block a user