Skip to content

Commit

Permalink
fix auth flow
Browse files Browse the repository at this point in the history
  • Loading branch information
wwsalmon committed Feb 12, 2023
1 parent a9603c5 commit 30e4b90
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"next": "13.1.6",
"next-auth": "^4.19.2",
"next-response-helpers": "^0.2.1",
"next-seo": "^5.15.0",
"postcss": "^8.4.21",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
6 changes: 3 additions & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ export default function Index({ thisUser, initVaxEvents }: {
<p>Sources:</p>
<ul className="list-disc pl-4 my-2">
<li className="my-2"><b>Primary series: Lin, Dan-Yu, et al. 2022 (n = 10.6 million)</b>. “Association of Primary and Booster Vaccination and Prior Infection with SARS-COV-2 Infection and Severe COVID-19 Outcomes.” JAMA, vol. 328, no. 14, 2022, p. 1415., https://doi.org/10.1001/jama.2022.17876.</li>
<li className="my-2"><b>First booster: Tseng, Hung Fu, et al. 2023 (n = 123,236)</b>. “Effectiveness of Mrna-1273 Vaccination against SARS-COV-2 Omicron Subvariants BA.1, Ba.2, Ba.2.12.1, Ba.4, and Ba.5.” Nature Communications, vol. 14, no. 1, 2023, https://doi.org/10.1038/s41467-023-35815-7.</li>
<li className="my-2"><b>Second booster: Ferdinants, Jill M, et al. 2022 (n = 893,461)</b>. “Waning of Vaccine Effectiveness against Moderate and Severe COVID-19 among Adults in the US from the Vision Network: Test Negative, Case-Control Study.” BMJ, 2022, https://doi.org/10.1136/bmj-2022-072141.</li>
<li className="my-2"><b>Booster data: Tseng, Hung Fu, et al. 2023 (n = 123,236)</b>. “Effectiveness of Mrna-1273 Vaccination against SARS-COV-2 Omicron Subvariants BA.1, Ba.2, Ba.2.12.1, Ba.4, and Ba.5.” Nature Communications, vol. 14, no. 1, 2023, https://doi.org/10.1038/s41467-023-35815-7.</li>
<li className="my-2"><b>Booster data: Ferdinands, Jill M, et al. 2022 (n = 893,461)</b>. “Waning of Vaccine Effectiveness against Moderate and Severe COVID-19 among Adults in the US from the Vision Network: Test Negative, Case-Control Study.” BMJ, 2022, https://doi.org/10.1136/bmj-2022-072141.</li>
</ul>
</div>
<hr className="my-8"/>
Expand Down Expand Up @@ -303,7 +303,7 @@ export default function Index({ thisUser, initVaxEvents }: {
export async function getServerSideProps(context: GetServerSidePropsContext) {
const session = await getSession(context);

if (!session) return { redirect: { permanent: false, destination: "/signin" } };
if (!session) return { redirect: { permanent: false, destination: "/lander" } };

try {
mongoose.set("strictQuery", false);
Expand Down
7 changes: 5 additions & 2 deletions pages/lander.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { signIn } from "next-auth/react";
import { useRouter } from "next/router";
import H1 from "../components/H1";

export default function Lander() {
const router = useRouter();

return (
<div className="w-full bg-gray-100 min-h-screen">
<div className="flex items-center justify-center pt-8">
Expand All @@ -15,15 +18,15 @@ export default function Lander() {
<div className="w-1/2 pr-16">
<H1 className="text-7xl">How safe are COVID vaccines actually keeping you?</H1>
<p className="text-2xl mt-8 opacity-75 leading-normal">Find out how protected you are <b>based off of your personal vaccination history</b> — and the latest peer-reviewed studies.</p>
<button onClick={() => signIn("google")} className="p-4 text-xl bg-accent text-white font-bold mt-8 rounded-md hover:opacity-75 transition hover:shadow-xl shadow-md">Find out your number</button>
<button onClick={() => router.push("/signin")} className="p-4 text-xl bg-accent text-white font-bold mt-8 rounded-md hover:opacity-75 transition hover:shadow-xl shadow-md">Find out your number</button>
</div>
<img src="/top.png" alt="screenshot of app" className="shadow-2xl w-1/2 ml-auto my-8 rounded-md"/>
</div>
<div className="max-w-7xl mx-auto py-16 border-b">
<H1 className="text-center">Make better decisions about COVID safety</H1>
<img src="/timeline.png" alt="screenshot of app" className="my-16 rounded-md shadow-2xl"/>
<div className="flex items-center justify-center">
<button onClick={() => signIn("google")} className="p-4 text-xl bg-accent text-white font-bold mt-8 rounded-md hover:opacity-75 transition hover:shadow-xl shadow-md">Get your timeline</button>
<button onClick={() => router.push("/signin")} className="p-4 text-xl bg-accent text-white font-bold mt-8 rounded-md hover:opacity-75 transition hover:shadow-xl shadow-md">Get your timeline</button>
</div>
</div>
<div className="max-w-7xl mx-auto py-16">
Expand Down
7 changes: 6 additions & 1 deletion pages/signin.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { GetServerSidePropsContext } from "next";
import {getSession, signIn} from "next-auth/react";
import { useEffect } from "react";

export default function SignIn() {
useEffect(() => {
signIn("google");
}, []);

return (
<button onClick={() => signIn("google")}>Sign in</button>
<></>
)
}

Expand Down

0 comments on commit 30e4b90

Please sign in to comment.