🚧 (wip) get oauth url from backend

this function is under development and still need fixing
This commit is contained in:
2025-08-22 22:43:34 +07:00
parent a6b8ba9c3d
commit ab5bbd3491
3 changed files with 29 additions and 2 deletions

View File

@ -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;

View File

@ -27,7 +27,7 @@ const LoginPage = () => {
useEffect(() => { useEffect(() => {
// Prevent opening devtools while in authentication page // Prevent opening devtools while in authentication page
disableDevtool(); // disableDevtool();
/** /**
* Check if the window has an opener (i.e., it was opened by another window) * Check if the window has an opener (i.e., it was opened by another window)

View File

@ -1,8 +1,24 @@
"use client";
import { Button } from "@heroui/react"; import { Button } from "@heroui/react";
import { Icon } from "@iconify/react"; import { Icon } from "@iconify/react";
import React from "react"; import React, { useEffect, useState } from "react";
import getGoogleAuthUrl from "../lib/getGoogleAuthUrl";
const OAuthProviders = () => { 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 // set to true if there are other providers coming soon
const comingSoonProviders: boolean = true; const comingSoonProviders: boolean = true;
@ -33,6 +49,8 @@ const OAuthProviders = () => {
); );
})} })}
<h1>{UrlOauth}</h1>
{comingSoonProviders && ( {comingSoonProviders && (
<Button className="w-full" variant="ghost" isDisabled> <Button className="w-full" variant="ghost" isDisabled>
Other login options will come soon Other login options will come soon