-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
85 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
import React from "react"; | ||
|
||
type Props = {}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,7 @@ | ||
import About from "@/app/Components/Main/Pages/About"; | ||
import Loading from "@/app/Components/Patterns/Loading"; | ||
import Network from "@/utils/Network"; | ||
type Props = { data: any; messages: string }; | ||
|
||
const AboutPage = ({ data, messages }: Props) => { | ||
console.log("data", data); | ||
|
||
if (!data) { | ||
return <Loading />; | ||
} | ||
|
||
return <About data={data} />; | ||
const AboutPage = () => { | ||
return <About />; | ||
}; | ||
|
||
export default AboutPage; | ||
|
||
export async function getServerSideProps(context: any) { | ||
try { | ||
const res = await Network.run(context, "GET", "/api/about/aboutget", null); | ||
|
||
return { | ||
props: { | ||
data: res.data || [], | ||
messages: "success", | ||
}, | ||
}; | ||
} catch (error) { | ||
console.log("error", error); | ||
|
||
return { | ||
props: { | ||
data: [], | ||
messages: "error", | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,7 @@ | ||
import Blog from "@/app/Components/Main/Pages/Blog"; | ||
import Loading from "@/app/Components/Patterns/Loading"; | ||
import { BlogPost } from "@/app/Configs/types"; | ||
import Network from "@/utils/Network"; | ||
|
||
type Props = { | ||
data: BlogPost[]; | ||
const BlogsPage = () => { | ||
return <Blog title='Blog Post' isTagPage={false} />; | ||
}; | ||
|
||
const BlogsPage = ({ data }: Props) => { | ||
if (data.length == 0) { | ||
return <Loading />; | ||
} | ||
return <Blog data={data} title='Blog Post' isTagPage={false} />; | ||
}; | ||
|
||
export default BlogsPage; | ||
|
||
export async function getServerSideProps(context: any) { | ||
try { | ||
const res = await Network.run(context, "GET", `/api/blogs`, null); | ||
|
||
return { | ||
props: { | ||
data: res.data || [], | ||
}, | ||
}; | ||
} catch (error) { | ||
console.log("error", error); | ||
return { | ||
props: { | ||
data: [], | ||
}, | ||
}; | ||
} | ||
} | ||
export default BlogsPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,7 @@ | ||
import Blog from "@/app/Components/Main/Pages/Blog"; | ||
import { BlogPost } from "@/app/Configs/types"; | ||
import Network from "@/utils/Network"; | ||
|
||
type Props = { | ||
data: BlogPost[]; | ||
errorMessage: boolean; | ||
}; | ||
|
||
const TagsPage = ({ data, errorMessage }: Props) => { | ||
return <Blog data={data} title='Tags Page' isTagPage={true} />; | ||
const TagsPage = () => { | ||
return <Blog title='Tags Page' isTagPage={true} />; | ||
}; | ||
|
||
export default TagsPage; | ||
|
||
export async function getServerSideProps(context: any) { | ||
const { tag } = context.query; | ||
|
||
if (!tag) { | ||
return { | ||
props: {}, | ||
}; | ||
} | ||
try { | ||
const res = await Network.run( | ||
context, | ||
"GET", | ||
`/api/blogs/blogtags?tag=${tag}`, | ||
null | ||
); | ||
return { | ||
props: { | ||
data: res.data || [], | ||
errorMessage: res.data == null ? true : false, | ||
}, | ||
}; | ||
} catch (error) { | ||
return { | ||
props: { | ||
data: [], | ||
errorMessage: true, | ||
}, | ||
}; | ||
} | ||
} |