Skip to content

Commit

Permalink
Update wod frontend wrt api-server
Browse files Browse the repository at this point in the history
  • Loading branch information
mahiagrawal01 committed Dec 7, 2024
1 parent 2dbb340 commit 5c0d1e1
Show file tree
Hide file tree
Showing 8 changed files with 31,536 additions and 2,454 deletions.
41 changes: 20 additions & 21 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,54 +71,53 @@ exports.createPages = async ({ graphql, actions }) => {
console.log('error: ', error);
}

try {
// eslint-disable-next-line max-len
const replaysApi = `${process.env.GATSBY_WORKSHOPCHALLENGE_API_ENDPOINT}/api/replays?active=true`;
const getReplays = await axios({
try {
const workshopsApi = `${process.env.GATSBY_WORKSHOPCHALLENGE_API_ENDPOINT}/api/workshops?active=true`;
const getWorkshops = await axios({
method: 'GET',
url: replaysApi,
url: workshopsApi,
});

getReplays.data.forEach(({ id, title, desc, workshop }) => {
console.log('API response:', getWorkshops.data);
getWorkshops.data.forEach(({ id, name, description, workshopImg, badgeImg }) => {
createPage({
path: `/hackshack/replays/${id}`,
component: require.resolve('./src/pages/hackshack/replays/template.js'),
context: {
workshopId: id,
workshopTitle: title,
workshopDesc: desc,
workshopImg: workshop && workshop.workshopImg,
workshopTitle: name,
workshopDesc: description,
workshopImg: workshopImg,
},
});

// console.log(`Create pages /hackshack/replays/${id} from ${id}`);
// console.log('------------------------------');

console.log(`Creating page for workshop ID: ${id}`);
createPage({
path: `/hackshack/workshop/${id}`,
component: require.resolve('./src/pages/hackshack/replays/template.js'),
context: {
workshopId: id,
workshopTitle: title,
workshopDesc: desc,
workshopImg: workshop && workshop.workshopImg,
workshopTitle: name,
workshopDesc: description,
workshopImg: workshopImg,
},
});

// console.log(`Create pages /hackshack/workshop/${id} from ${id}`);
// console.log('------------------------------');

createPage({
path: `/hackshack/workshop/${id}/finisher-badge`,
component: require.resolve('./src/pages/hackshack/replays/template.js'),
context: {
workshopId: id,
workshopTitle: title,
workshopDesc: desc,
workshopImg: workshop && workshop.badgeImg,
workshopTitle: name,
workshopDesc: description,
workshopImg: badgeImg,
},
});

// console.log(
// `Create pages /hackshack/workshop/${id}/finisher-badge from ${id}`,
// );
Expand Down
Loading

0 comments on commit 5c0d1e1

Please sign in to comment.