blob: f06c64fb86ede1f4ca98b782cd08fe928e25ebfe [file] [log] [blame]
TheCodedProf2a69bd92023-03-02 16:36:32 -05001import Axios from 'axios';
2
3const t = () => { return <></>}
4export default t
5export 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 Grey6c3d4632023-03-06 09:51:21 +000017 code = (await Axios.get(`${process.env.NUCLEUS_CALLBACK}transcript/${ctx.params.code}`))
TheCodedProf2a69bd92023-03-02 16:36:32 -050018 } catch (e) {
19 return {
20 redirect: {
21 destination: '/nucleus/transcript/invalid',
22 permanent: true
23 }
24 }
25 }
26 return {
27 redirect: {
Skyler Grey6c3d4632023-03-06 09:51:21 +000028 destination: `${process.env.NUCLEUS_CALLBACK}transcript/${ctx.params.code}`,
TheCodedProf2a69bd92023-03-02 16:36:32 -050029 permanent: true
30 }
31 }
Skyler Grey6c3d4632023-03-06 09:51:21 +000032}