resolve conflicts and add readme and correct pathnames #13
@@ -20,6 +20,11 @@
|
|||||||
"static/chunks/main.js",
|
"static/chunks/main.js",
|
||||||
"static/chunks/pages/index.js"
|
"static/chunks/pages/index.js"
|
||||||
],
|
],
|
||||||
|
"/[book]/[type]/[id]": [
|
||||||
|
"static/chunks/webpack.js",
|
||||||
|
"static/chunks/main.js",
|
||||||
|
"static/chunks/pages/[book]/[type]/[id].js"
|
||||||
|
],
|
||||||
"/_app": [
|
"/_app": [
|
||||||
"static/chunks/webpack.js",
|
"static/chunks/webpack.js",
|
||||||
"static/chunks/main.js",
|
"static/chunks/main.js",
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
self.__BUILD_MANIFEST={"polyfillFiles":["static/chunks/polyfills.js"],"devFiles":["static/chunks/react-refresh.js"],"ampDevFiles":["static/chunks/webpack.js","static/chunks/amp.js"],"lowPriorityFiles":["static/development/_buildManifest.js","static/development/_ssgManifest.js"],"rootMainFiles":[],"pages":{"/":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/index.js"],"/_app":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_app.js"],"/_error":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_error.js"],"/search":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/search.js"]},"ampFirstPages":[]}
|
self.__BUILD_MANIFEST={"polyfillFiles":["static/chunks/polyfills.js"],"devFiles":["static/chunks/react-refresh.js"],"ampDevFiles":["static/chunks/webpack.js","static/chunks/amp.js"],"lowPriorityFiles":["static/development/_buildManifest.js","static/development/_ssgManifest.js"],"rootMainFiles":[],"pages":{"/":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/index.js"],"/[book]/[type]/[id]":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/[book]/[type]/[id].js"],"/_app":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_app.js"],"/_error":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_error.js"],"/search":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/search.js"]},"ampFirstPages":[]}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"/_app": "pages/_app.js",
|
"/_app": "pages/_app.js",
|
||||||
"/_document": "pages/_document.js",
|
|
||||||
"/_error": "pages/_error.js",
|
"/_error": "pages/_error.js",
|
||||||
"/": "pages/index.js",
|
"/_document": "pages/_document.js",
|
||||||
"/search": "pages/search.js"
|
"/search": "pages/search.js",
|
||||||
|
"/[book]/[type]/[id]": "pages/[book]/[type]/[id].js",
|
||||||
|
"/": "pages/index.js"
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
/******/
|
/******/
|
||||||
/******/ /* webpack/runtime/getFullHash */
|
/******/ /* webpack/runtime/getFullHash */
|
||||||
/******/ !function() {
|
/******/ !function() {
|
||||||
/******/ __webpack_require__.h = function() { return "6b525e2862ea73db"; }
|
/******/ __webpack_require__.h = function() { return "ef0f344f355fd93b"; }
|
||||||
/******/ }();
|
/******/ }();
|
||||||
/******/
|
/******/
|
||||||
/******/ /* webpack/runtime/global */
|
/******/ /* webpack/runtime/global */
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
self.__BUILD_MANIFEST = {__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static\u002Fchunks\u002Fpages\u002Findex.js"],"/_error":["static\u002Fchunks\u002Fpages\u002F_error.js"],"/search":["static\u002Fchunks\u002Fpages\u002Fsearch.js"],sortedPages:["\u002F","\u002F_app","\u002F_error","\u002Fsearch"]};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()
|
self.__BUILD_MANIFEST = {__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static\u002Fchunks\u002Fpages\u002Findex.js"],"/_error":["static\u002Fchunks\u002Fpages\u002F_error.js"],"/search":["static\u002Fchunks\u002Fpages\u002Fsearch.js"],"/[book]/[type]/[id]":["static\u002Fchunks\u002Fpages\u002F[book]\u002F[type]\u002F[id].js"],sortedPages:["\u002F","\u002F_app","\u002F_error","\u002Fsearch","\u002F[book]\u002F[type]\u002F[id]"]};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()
|
||||||
File diff suppressed because one or more lines are too long
@@ -33,7 +33,7 @@ const Result = ({result, term}) => {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div onClick={() => (router.push({pathname: `/${result._type}/${result._id}`}))} className='
|
<div onClick={() => (router.push({pathname: `${result._index}/${result._type}/${result._id}`}))} className='
|
||||||
self-end
|
self-end
|
||||||
bg-[#202124]
|
bg-[#202124]
|
||||||
w-[100%]
|
w-[100%]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export const ENV_VAR = "http://localhost:9200/"
|
export const ENV_VAR = "http://localhost:9200"
|
||||||
@@ -1,24 +1,23 @@
|
|||||||
import { AiOutlineLeft, AiOutlineRight } from 'react-icons/ai'
|
import { AiOutlineLeft, AiOutlineRight } from 'react-icons/ai'
|
||||||
import Link from "next/link"
|
import Link from "next/link"
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { ENV_VAR } from '../../../envconfig'
|
import { ENV_VAR } from '../../../../envconfig'
|
||||||
|
|
||||||
|
|
||||||
const result = ({data}) => {
|
const result = ({data}) => {
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
console.log(data)
|
|
||||||
const {book, writer, text} = data._source
|
const {book, writer, text} = data._source
|
||||||
const nextPageHandler = () => {
|
const nextPageHandler = () => {
|
||||||
if(Number(data._id) + 1 === Number(data._source.numOfPages) + 1) return
|
if(Number(data._id) + 1 === Number(data._source.pages) + 1) return
|
||||||
|
|
||||||
router.push(`/${book.toLowerCase()}/${Number(data._id) + 1}`)
|
router.push(`/${data._index}/${data._type}/${Number(data._id) + 1}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const prevPageHandler = () => {
|
const prevPageHandler = () => {
|
||||||
if(data._id - 1 === 0) return
|
if(data._id - 1 === 0) return
|
||||||
|
|
||||||
router.push(`/${book.toLowerCase()}/${Number(data._id) - 1}`)
|
router.push(`/${data._index}/${data._type}/${Number(data._id) - 1}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -82,9 +81,8 @@ export default result
|
|||||||
export async function getServerSideProps (context) {
|
export async function getServerSideProps (context) {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
const res = await fetch(`${ENV_VAR}library${context.resolvedUrl}`)
|
const res = await fetch(`${ENV_VAR}${context.resolvedUrl}`)
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
|
|
||||||
return { props: {data} }
|
return { props: {data} }
|
||||||
}
|
}
|
||||||
catch{err => console.log(err)}
|
catch{err => console.log(err)}
|
||||||
@@ -57,7 +57,7 @@ const SearchPage = ({data}) => {
|
|||||||
|
|
||||||
export async function getServerSideProps(context) {
|
export async function getServerSideProps(context) {
|
||||||
// Fetch data from external API
|
// Fetch data from external API
|
||||||
const res = await fetch(`${ENV_VAR}_search?q=${context.query.term}`)
|
const res = await fetch(`${ENV_VAR}/_search?q=${context.query.term}`)
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
|
|
||||||
// Pass data to the page via props
|
// Pass data to the page via props
|
||||||
|
|||||||
Reference in New Issue
Block a user