Skip to content

Commit

Permalink
Loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Lu Nguyen committed Apr 27, 2023
1 parent 0b86e6f commit 543b8b2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/SSOButton/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React from 'react';
import React, { useState } from 'react';
import { handleWalletResponse } from '../utils/index';
import Spinner from '../Spinner/index';

const SSOButton = ({ className, text, onGetData, options }) => {
const [loading, setLoading] = useState(false);

const handleSSO = async () => {
setLoading(true);
handleWalletResponse(
process.env.REACT_APP_ENDPOINT_URL ?? process.env.NEXT_PUBLIC_ENDPOINT_URL,
process.env.REACT_APP_SSO_CLIENT_ID ?? process.env.NEXT_PUBLIC_SSO_CLIENT_ID,
Expand All @@ -11,6 +15,9 @@ const SSOButton = ({ className, text, onGetData, options }) => {
);
};

if (loading) {
return <Spinner />;
}
return (
<button type="button" className={`btn ${className}`} onClick={handleSSO}>
{text}
Expand Down

0 comments on commit 543b8b2

Please sign in to comment.