parent
a525995609
commit
2e788967b2
@ -0,0 +1,29 @@
|
||||
import { useRouter } from 'next/router';
|
||||
import { URL_LEGACY } from '@services/constants';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export async function getServerSideProps({ query, locale }) {
|
||||
const { pid, tid: token } = query;
|
||||
|
||||
return {
|
||||
props: {
|
||||
token: token || null,
|
||||
pid,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const Results = ({ token, pid }) => {
|
||||
const router = useRouter();
|
||||
const url = token
|
||||
? new URL(`/result/${pid}/${token}`, URL_LEGACY)
|
||||
: new URL(`/result/${pid}`, URL_LEGACY);
|
||||
|
||||
useEffect(() => {
|
||||
router.push(url.href);
|
||||
}, []);
|
||||
|
||||
return <p>Redirecting to {url.href}</p>;
|
||||
};
|
||||
|
||||
export default Results;
|
@ -0,0 +1,29 @@
|
||||
import { useRouter } from 'next/router';
|
||||
import { URL_LEGACY } from '@services/constants';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export async function getServerSideProps({ query, locale }) {
|
||||
const { pid, tid: token } = query;
|
||||
|
||||
return {
|
||||
props: {
|
||||
token: token || null,
|
||||
pid,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const Votes = ({ token, pid }) => {
|
||||
const router = useRouter();
|
||||
const url = token
|
||||
? new URL(`/vote/${pid}/${token}`, URL_LEGACY)
|
||||
: new URL(`/vote/${pid}`, URL_LEGACY);
|
||||
|
||||
useEffect(() => {
|
||||
router.push(url.href);
|
||||
}, []);
|
||||
|
||||
return <p>Redirecting to {url.href}</p>;
|
||||
};
|
||||
|
||||
export default Votes;
|
Loading…
Reference in new issue