TheCodedProf | 2a69bd9 | 2023-03-02 16:36:32 -0500 | [diff] [blame] | 1 | import Axios from 'axios'; |
| 2 | |
| 3 | const t = () => { return <></>} |
| 4 | export default t |
| 5 | export async function getServerSideProps(ctx) { |
| 6 | console.log(ctx.req.url) |
| 7 | if(!ctx.params.code) { |
| 8 | return { |
| 9 | redirect: { |
| 10 | destination: '/nucleus/transcript/about', |
| 11 | permanent: true |
| 12 | } |
| 13 | } |
| 14 | } |
| 15 | let code; |
| 16 | try { |
Skyler Grey | 6c3d463 | 2023-03-06 09:51:21 +0000 | [diff] [blame] | 17 | code = (await Axios.get(`${process.env.NUCLEUS_CALLBACK}transcript/${ctx.params.code}`)) |
TheCodedProf | 2a69bd9 | 2023-03-02 16:36:32 -0500 | [diff] [blame] | 18 | } catch (e) { |
| 19 | return { |
| 20 | redirect: { |
| 21 | destination: '/nucleus/transcript/invalid', |
| 22 | permanent: true |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | return { |
| 27 | redirect: { |
Skyler Grey | 6c3d463 | 2023-03-06 09:51:21 +0000 | [diff] [blame] | 28 | destination: `${process.env.NUCLEUS_CALLBACK}transcript/${ctx.params.code}`, |
TheCodedProf | 2a69bd9 | 2023-03-02 16:36:32 -0500 | [diff] [blame] | 29 | permanent: true |
| 30 | } |
| 31 | } |
Skyler Grey | 6c3d463 | 2023-03-06 09:51:21 +0000 | [diff] [blame] | 32 | } |