Skip to content

Commit

Permalink
[fix] Base path
Browse files Browse the repository at this point in the history
  • Loading branch information
SandeepYadav99 committed Aug 19, 2023
1 parent daea470 commit 77114b4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 38 deletions.
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
basePath:'/TRAVEL-TIPPLER',
images: {
domains: ["www.traveltippler.com"],
unoptimized: true ,
Expand Down
17 changes: 9 additions & 8 deletions src/app/category/[categoryIds]/page.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import React from "react";
import CategoryDetail from "@/pages/CategoryDetail/CategoryDetail";

const CategoryIds = async() => {
const postData = await fetchPostLists();
const CategoryIds = () => {
// const postData = await fetchPostLists();

return (
<CategoryDetail postData={postData}/>
<CategoryDetail />
);
};

export default CategoryIds;


export const fetchPostLists =async () => {
const data = await fetch("https://www.traveltippler.com/wp-json/wp/v2/posts");
const responseData = await data.json();
return responseData
}
// export const fetchPostLists = async () => {
// const data = await fetch("https://www.traveltippler.com/wp-json/wp/v2/posts");
// const responseData = await data.json();
// return responseData
// }
2 changes: 1 addition & 1 deletion src/pages/Category/Category_Post.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import useCategoryName from "@/components/hooks/ConvertCaps";
import { useRouter } from "next/navigation";

const Category_Post = ({ id, image,category, aurther,heading , date, description}) => {

const router = useRouter();

const categoryType = useCategoryName(category);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Category/CategorysList.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const CategorysList = ({ fetch_categories }) => {
<Link
href={`/category/${slug}`}
className="text-[16px] courser-pointer "
dangerouslySetInnerHTML={{__html: name}}
>
{name}
</Link>

<p className="border-2 rounded-md h-6 w-6 flex justify-center text-[11px] bg-gray-100 ">{count}</p>
Expand Down
36 changes: 8 additions & 28 deletions src/pages/CategoryDetail/CategoryDetail.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
"use client";
import React from 'react'
import Category_Post from '../Category/Category_Post';
import CATEGORYs from '@/components/helper/CATEGORYs';
import Follow from "@/pages/Category/Social_Links";
import RecentPost from "@/pages/Category/RecentPost";
import CategorysList from "@/pages/Category/CategorysList";
import { useParams } from 'next/navigation';
import formatCategory from '@/components/hooks/ConvertSmall';
import CATEGORYs from '@/components/helper/CATEGORYs';


const CategoryDetail = ({ postData }) => {
console.log(postData)
const CategoryDetail = () => {
const params = useParams();
// const paramsList = formatCategory(params.categoryIds);
// console.log(params.categoryIds);
// is: - id, content->rendered, heading

return (
<div className="md:flex md:justify-between mx-[5%] md:mt-2 ">
<div className=" sm:w-max-[1160px] bg-white h-auto">
<div className="mt-4">
<h1 className="text-2xl font-bold ml-[2%]">{params.categoryIds}</h1>
</div>
<hr className="m-6" />
{CATEGORYs.map((category, index) => {
if (category.category === params.categoryIds) {
{CATEGORYs.map((category, index) => {
if (category.category.toLowerCase().split(" ").join("-") === params.categoryIds) {
return (
<Category_Post
key={category.id}
Expand All @@ -35,25 +32,8 @@ const CategoryDetail = ({ postData }) => {
);
}
return null;
})}
{/* {postData.map((category)=>{
const urlParts = category.link.split("/");
// console.log(urlParts)
if(urlParts.includes(params.categoryIds)){
return (
<Category_Post
id={category.id}
key={category.id}
description={category.content.rendered}
date={category.date}
image={category.image}
category={category.category}
aurther={category.aurther}
heading={category.title} />
);
}
return null;
})} */}
})}
{/* // const urlParts = category.link.split("/"); */}
</div>
<div className="sm:w-[35rem] mt-2">
<Follow />
Expand Down

0 comments on commit 77114b4

Please sign in to comment.