title: import a single getServerSideProps method to multiple pages in Nextjs
body: <p>I'm trying to import the getServerSideProps method from this page to another and use it throughout multiple pages. How can I do that?</p>
  <p>Heres my code:</p>
  <pre><code>import DashboardLayout from &quot;@app/layout/DashboardLayout&quot;;
  import Overview from &quot;@containers/dashboard/Overview&quot;;
  import { parsedCookie } from &quot;@infrastructure/utils/functions&quot;;
  
  const OverviewPage = () =&gt; {
    return (
      &lt;DashboardLayout&gt;
        &lt;Overview /&gt;
      &lt;/DashboardLayout&gt;
    );
  };
  
  export default OverviewPage;
  
  export const getServerSideProps = async (context) =&gt; {
    const token = parsedCookie(context.req);
    const { accessToken, refreshToken } = token;
    if (!accessToken || !refreshToken) {
      return {
        redirect: {
          destination: &quot;/&quot;,
          permanent: false,
        },
      };
    }
  
    return {
      props: {},
    };
  };
  </code></pre>