update redirection logic for invites
This commit is contained in:
parent
f2589efc94
commit
a764837776
|
@ -111,7 +111,7 @@ export function getGetServerSideProps (
|
|||
}
|
||||
|
||||
if (error || !data || (notFound && notFound(data, vars, me))) {
|
||||
res.writeHead(301, {
|
||||
res.writeHead(302, {
|
||||
Location: '/404'
|
||||
}).end()
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ export default function Invite ({ invite, active }) {
|
|||
<CopyInput
|
||||
groupClassName='mb-1'
|
||||
size='sm' type='text'
|
||||
placeholder={`https://stacker.news/invites/${invite.id}`} readOnly noForm
|
||||
placeholder={`${process.env.NODE_ENV === 'development' ? 'http://localhost:3000' : 'https://stacker.news'}/invites/${invite.id}`} readOnly noForm
|
||||
/>
|
||||
<div className={styles.other}>
|
||||
<span>{invite.gift} sat gift</span>
|
||||
|
|
|
@ -26,9 +26,10 @@ export async function getServerSideProps ({ req, res, query: { id, error = null
|
|||
})
|
||||
|
||||
if (!data?.invite) {
|
||||
res.writeHead(301, {
|
||||
res.writeHead(302, {
|
||||
Location: '/404'
|
||||
}).end()
|
||||
return { props: {} }
|
||||
}
|
||||
|
||||
if (session && res) {
|
||||
|
@ -43,12 +44,10 @@ export async function getServerSideProps ({ req, res, query: { id, error = null
|
|||
console.log(e)
|
||||
}
|
||||
|
||||
return {
|
||||
redirect: {
|
||||
destination: '/',
|
||||
permanent: false
|
||||
}
|
||||
}
|
||||
res.writeHead(302, {
|
||||
Location: '/'
|
||||
}).end()
|
||||
return { props: {} }
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue