Skip to content

Commit

Permalink
fix(partner): add getStaticProps and getStaticPaths to generate page
Browse files Browse the repository at this point in the history
  • Loading branch information
whalekiller03 committed Jan 2, 2024
1 parent 8ecdc20 commit 7212670
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions pages/partner/[id]/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,9 @@ const HomePageWrapper = styled.div`
--section-height-offset: 80px;
`;

const index = () => {
const index = ({ user }) => {
const router = useRouter();
const { id } = router.query;
const user = {
name: '黃芊宇',
educationStepLabel: '大學',
tagList: [
'實驗教育實驗教育',
'標籤最多是八個字',
'前端工程師',
'後端工程師',
'太多標籤第二行',
'戶外運動',
],
photoURL: 'https://i.imgur.com/QpMVwqe.png',
location: '台北市松山區',
};

const fetchUser = async () => {
console.log(id);

Check warning

Code scanning / CodeQL

Log injection Medium

Log entry depends on a
user-provided value
.
Expand All @@ -47,3 +33,31 @@ const index = () => {
};

export default index;

export async function getStaticPaths() {
return {
paths: [{ params: { id: '22' } }],
fallback: true,
};
}

export const getStaticProps = async () => {
return {
props: {
user: {
name: '黃芊宇',
educationStepLabel: '大學',
tagList: [
'實驗教育實驗教育',
'標籤最多是八個字',
'前端工程師',
'後端工程師',
'太多標籤第二行',
'戶外運動',
],
photoURL: 'https://i.imgur.com/QpMVwqe.png',
location: '台北市松山區',
},
},
};
};

0 comments on commit 7212670

Please sign in to comment.