Skip to content

Commit

Permalink
chore(login): remote cumbersome login button path
Browse files Browse the repository at this point in the history
  • Loading branch information
jonassimoen committed Nov 28, 2023
1 parent ba6a11a commit 33ec2a4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 47 deletions.
18 changes: 15 additions & 3 deletions src/pages/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useAppSelector } from "@/reducers";
import Title from "antd/es/typography/Title";
import Meta from "antd/es/card/Meta";
import { Card } from "antd";
import config from "@/config";

export declare type HomeProps = {
// onLogOut?: () => void
Expand All @@ -20,11 +21,22 @@ export const Home = (props: HomeProps) => {
const authenticated = useAppSelector((state) => state.userState.authenticated);
const teams: any[] = [];
const { t } = useTranslation();
// const deadlineDate = props.matches && props.matches.info && props.matches.
// const redirectToMyTeams = props.match.path === '/' && props.user && props.user.authenticated
const redirectToMyTeams = true;
const team = teams && teams[0];

const rootUrl = "https://accounts.google.com/o/oauth2/v2/auth";
const options = {
redirect_uri: `${config.API_URL}/user/oauth/google`,
client_id: config.GOOGLE_CLIENT_ID,
access_type: "offline",
response_type: "code",
prompt: "consent",
scope: ["https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/userinfo.email"].join(
" "
),
};
const qs = new URLSearchParams(options);

return (
<HomeStyle>
{
Expand All @@ -38,7 +50,7 @@ export const Home = (props: HomeProps) => {
<p>{t("home.welcome")}</p>
</Col>
<Col md={12} lg={12} sm={24} xs={24}>
<Link to="/login">
<Link to={`${rootUrl}?${qs.toString()}`}>
<Button className="playNow">
{t("home.playBtn")}
</Button>
Expand Down
40 changes: 0 additions & 40 deletions src/pages/Login.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ export const router = createBrowserRouter([
path: "/rules", //todo
element: <ProtectedRoute access={true} redirectPath="/home"><Rules /></ProtectedRoute>
},
{
path: "/login",
element: <Login />,
},
{
path: "/admin",
element: <ProtectedRoute access={true} redirectPath='/home'><Admin redirectPath='/home' /></ProtectedRoute>,
Expand Down

0 comments on commit 33ec2a4

Please sign in to comment.