import React, { useEffect } from "react";
import { useAuth } from "../hooks/Auth";
function OAuth() {
let auth = useAuth();
useEffect(() => {
const params = new URLSearchParams(window.location.search);
const data = {
code: params.get("code"),
state: params.get("state"),
};
// TODO: test things by changing redirect uri
auth.login(
data,
() => {
// TODO: use react-hot-toast for login, announcement etc. notifs
console.log("succex");
},
(e) => {
console.log(e);
alert("Server Error! Please try again");
}
);
// DOUBT(@rakaar): what is the need for this?
// if (!res["isNewUser"]) props.history.push("/dashboard/mentor");
}, []);
return (
test things by changing redirect uri
https://github.com/kossiitkgp/KWoC-21-Frontend/blob/121a45e5adf55fb809955519722d0880043140cb/src/components/OAuth.js#L14
4ec0981b150aedd9151533fda9dd33cf6af60144