🚧 (wip) get oauth url from backend
this function is under development and still need fixing
This commit is contained in:
9
features/auth/lib/getGoogleAuthUrl.ts
Normal file
9
features/auth/lib/getGoogleAuthUrl.ts
Normal 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;
|
||||||
@ -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)
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user