Skip to content

Commit 33f9ff3

Browse files
authored
Update committee.js
1 parent b0edd2e commit 33f9ff3

1 file changed

Lines changed: 19 additions & 24 deletions

File tree

src/pages/committee.js

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -95,30 +95,25 @@ export default function Committee({ committeeData = {} }) {
9595
// -----------------------------
9696
// Data fetching
9797
// -----------------------------
98-
// export async function getStaticProps() {
99-
// try {
100-
// const res = await fetch(
101-
// "https://wrcrobotics.pythonanywhere.com/committee"
102-
// );
103-
104-
// const committeeData = await res.json();
105-
106-
// return {
107-
// props: { committeeData },
108-
// revalidate: 10,
109-
// };
110-
// } catch (err) {
111-
// return {
112-
// props: { committeeData: {} },
113-
// revalidate: 10,
114-
// };
115-
// }
116-
// }
117-
useEffect(() => {
118-
fetch("https://wrcrobotics.pythonanywhere.com/committee")
119-
.then(res => res.json())
120-
.then(setData);
121-
}, []);
98+
export async function getStaticProps() {
99+
try {
100+
const res = await fetch(
101+
"https://wrcrobotics.pythonanywhere.com/committee"
102+
);
103+
104+
const committeeData = await res.json();
105+
106+
return {
107+
props: { committeeData },
108+
revalidate: 10,
109+
};
110+
} catch (err) {
111+
return {
112+
props: { committeeData: {} },
113+
revalidate: 10,
114+
};
115+
}
116+
}
122117

123118
// -----------------------------
124119
// Styles (cleaned)

0 commit comments

Comments
 (0)