blob: da6ac40174caafaf88dee8381c7170a28f8a6e97 [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 {
TheCodedProff054b8c2023-03-03 15:32:19 -050017 code = (await Axios.get(`http://${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: {
TheCodedProff054b8c2023-03-03 15:32:19 -050028 destination: `http://${process.env.NUCLEUS_CALLBACK}/transcript/${ctx.params.code}`,
TheCodedProf2a69bd92023-03-02 16:36:32 -050029 permanent: true
30 }
31 }
32}