blob: 18273ef38e4b130f535ab3b42614451404f05dd7 [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 if(!ctx.params.code) {
7 return {
8 redirect: {
9 destination: '/nucleus/transcript/about',
10 permanent: true
11 }
12 }
13 }
14 let code;
15 try {
TheCodedProff054b8c2023-03-03 15:32:19 -050016 code = (await Axios.get(`http://${process.env.NUCLEUS_CALLBACK}/transcript/${ctx.params.code}`))
TheCodedProf2a69bd92023-03-02 16:36:32 -050017 } catch (e) {
18 return {
19 redirect: {
20 destination: '/nucleus/transcript/invalid',
21 permanent: true
22 }
23 }
24 }
25 return {
26 redirect: {
TheCodedProff054b8c2023-03-03 15:32:19 -050027 destination: `http://${process.env.NUCLEUS_CALLBACK}/transcript/${ctx.params.code}/human`,
TheCodedProf2a69bd92023-03-02 16:36:32 -050028 permanent: true
29 }
30 }
31}