-
Notifications
You must be signed in to change notification settings - Fork 108
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
7 changed files
with
827 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,4 +145,4 @@ const NewsLetter = () => { | |
); | ||
}; | ||
|
||
export default NewsLetter; | ||
export default NewsLetter; |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { NextApiRequest, NextApiResponse } from 'next'; | ||
|
||
export const config = { | ||
api: { | ||
bodyParser: true, | ||
}, | ||
}; | ||
export default async function handler( | ||
req: NextApiRequest, | ||
res: NextApiResponse | ||
) { | ||
try { | ||
const data = req.body; | ||
const id = data.id; | ||
const object = data.data; | ||
const response = await fetch( | ||
`${ | ||
process.env.NEXT_PUBLIC_API_ENDPOINT as string | ||
}/api/hackathons/update/${id}`, | ||
{ | ||
method: 'post', | ||
body: JSON.stringify(object), | ||
headers: { | ||
'Content-type': 'application/json', | ||
}, | ||
} | ||
).then((r) => { | ||
if (r.status === 500) { | ||
throw 'Some error occurrend'; | ||
} | ||
return r.json(); | ||
}); | ||
res.status(200).json(response); | ||
} catch (error) { | ||
res.status(500).json({ success: false, error: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { NextApiRequest, NextApiResponse } from 'next'; | ||
|
||
export default async function handler( | ||
req: NextApiRequest, | ||
res: NextApiResponse | ||
) { | ||
try { | ||
const id = req.body.id; | ||
const response = await fetch( | ||
`${process.env.NEXT_PUBLIC_API_ENDPOINT}/api/hackathons/id/${id}`, | ||
{ | ||
method: 'get', | ||
headers: { | ||
'Content-type': 'application/json', | ||
}, | ||
} | ||
).then((resp) => { | ||
if (resp.status === 500) { | ||
throw 'Some error occurrend'; | ||
} | ||
return resp.json(); | ||
}); | ||
res.status(200).json(response); | ||
} catch (error) { | ||
res.status(500).json({ success: false, error: error }); | ||
} | ||
} |
Oops, something went wrong.