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 | if(!ctx.params.code) { |
| 7 | return { |
| 8 | redirect: { |
| 9 | destination: '/nucleus/transcript/about', |
| 10 | permanent: true |
| 11 | } |
| 12 | } |
| 13 | } |
| 14 | let code; |
| 15 | try { |
Skyler Grey | 6c3d463 | 2023-03-06 09:51:21 +0000 | [diff] [blame^] | 16 | code = (await Axios.get(`${process.env.NUCLEUS_CALLBACK}transcript/${ctx.params.code}?key=${ctx.query.key}&iv=${ctx.query.iv}`)) |
TheCodedProf | 2a69bd9 | 2023-03-02 16:36:32 -0500 | [diff] [blame] | 17 | } catch (e) { |
| 18 | return { |
| 19 | redirect: { |
| 20 | destination: '/nucleus/transcript/invalid', |
| 21 | permanent: true |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | return { |
| 26 | redirect: { |
Skyler Grey | 6c3d463 | 2023-03-06 09:51:21 +0000 | [diff] [blame^] | 27 | destination: `${process.env.NUCLEUS_CALLBACK}transcript/${ctx.params.code}?key=${ctx.query.key}&iv=${ctx.query.iv}/human`, |
TheCodedProf | 2a69bd9 | 2023-03-02 16:36:32 -0500 | [diff] [blame] | 28 | permanent: true |
| 29 | } |
| 30 | } |
Samuel Shuert | 61ddba1 | 2023-03-05 21:19:11 -0500 | [diff] [blame] | 31 | } |