diff --git a/features/auth/lib/getGoogleAuthUrl.ts b/features/auth/lib/getGoogleAuthUrl.ts new file mode 100644 index 0000000..aa93eca --- /dev/null +++ b/features/auth/lib/getGoogleAuthUrl.ts @@ -0,0 +1,9 @@ +"use server"; +import { api } from "@/shared/api/connector"; + +const getGoogleAuthUrl = async () => { + const res = await api.get(`debug`); + return res.json(); +}; + +export default getGoogleAuthUrl; diff --git a/features/auth/pages/LoginPage.tsx b/features/auth/pages/LoginPage.tsx index 883ba9f..673c0c7 100644 --- a/features/auth/pages/LoginPage.tsx +++ b/features/auth/pages/LoginPage.tsx @@ -27,7 +27,7 @@ const LoginPage = () => { useEffect(() => { // Prevent opening devtools while in authentication page - disableDevtool(); + // disableDevtool(); /** * Check if the window has an opener (i.e., it was opened by another window) diff --git a/features/auth/ui/OAuthProviders.tsx b/features/auth/ui/OAuthProviders.tsx index a351f03..7f1af46 100644 --- a/features/auth/ui/OAuthProviders.tsx +++ b/features/auth/ui/OAuthProviders.tsx @@ -1,8 +1,24 @@ +"use client"; + import { Button } from "@heroui/react"; import { Icon } from "@iconify/react"; -import React from "react"; +import React, { useEffect, useState } from "react"; +import getGoogleAuthUrl from "../lib/getGoogleAuthUrl"; const OAuthProviders = () => { + const [UrlOauth, setUrlOauth] = useState("please wait..."); + + useEffect(() => { + (async () => { + try { + const res = await getGoogleAuthUrl(); // panggil server function + setUrlOauth(JSON.stringify(res)); + } catch (err) { + console.error(err); + } + })(); + }, []); + // set to true if there are other providers coming soon const comingSoonProviders: boolean = true; @@ -33,6 +49,8 @@ const OAuthProviders = () => { ); })} +

{UrlOauth}

+ {comingSoonProviders && (