mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-05 07:26:46 +00:00
hotfix-waline-cors
This commit is contained in:
@@ -13,31 +13,22 @@ export const WalineComponent = (props) => {
|
|||||||
const containerRef = React.createRef()
|
const containerRef = React.createRef()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
const updateWaline = url => {
|
||||||
|
walineInstanceRef.current?.update(props)
|
||||||
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
walineInstanceRef.current = init({
|
walineInstanceRef.current = init({
|
||||||
...props,
|
...props,
|
||||||
el: containerRef.current,
|
el: containerRef.current,
|
||||||
serverURL: BLOG.COMMENT_WALINE_SERVER_URL
|
serverURL: BLOG.COMMENT_WALINE_SERVER_URL
|
||||||
})
|
})
|
||||||
|
|
||||||
return () => walineInstanceRef.current?.destroy()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const updateWaline = url => {
|
|
||||||
walineInstanceRef.current?.update(props)
|
|
||||||
}
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
walineInstanceRef.current?.update(props)
|
|
||||||
router.events.on('routeChangeComplete', updateWaline)
|
router.events.on('routeChangeComplete', updateWaline)
|
||||||
return () => {
|
return () => {
|
||||||
|
walineInstanceRef.current?.destroy()
|
||||||
router.events.off('routeChangeComplete', updateWaline)
|
router.events.off('routeChangeComplete', updateWaline)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
return <div ref={containerRef} />
|
return <div ref={containerRef} />
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user