Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dikisiswanto committed Sep 9, 2021
1 parent a229988 commit 97b43a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion pages/surah/[surahId].js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Footer from '../../components/footer';
import ApiService from '../../services/api';
import app from '../../data/app.json';

export async function getServerSideProps({ params }) {
export async function getStaticProps({ params }) {
const { surahId } = params;
const surah = await ApiService.getSurah(surahId);
const previousSurah = await ApiService.getSurah(parseInt(surahId, 10) - 1);
Expand All @@ -20,6 +20,15 @@ export async function getServerSideProps({ params }) {
};
}

export async function getStaticPaths() {
const surahs = await ApiService.getAllSurah();
const paths = surahs.map((surah) => ({
params: { surahId: `${surah.number}` },
}));

return { paths, fallback: false };
}

export default function SurahPage({ surah, previousSurah, nextSurah }) {
return (
<>
Expand Down
2 changes: 1 addition & 1 deletion public/sw.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 97b43a4

@vercel
Copy link

@vercel vercel bot commented on 97b43a4 Sep 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.