Skip to content

Commit

Permalink
feat: add handler to oauth confirm button
Browse files Browse the repository at this point in the history
  • Loading branch information
olexh committed Aug 24, 2024
1 parent 63db6f3 commit e78cb17
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/features/oauth/confirm.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { FC } from 'react';

import { Button } from '@/components/ui/button';

import useRequestTokenReference from '@/services/hooks/auth/use-request-token-reference';
import useSession from '@/services/hooks/auth/use-session';
import useClient from '@/services/hooks/client/use-client';

interface Props {}

Expand All @@ -18,12 +18,24 @@ const Confirm: FC<Props> = () => {

const { user } = useSession();

const { data: client } = useClient({
client_reference: reference,
});
const { mutate, isPending } = useRequestTokenReference();

const handleConfirm = () => {
mutate({
params: {
client_reference: reference,
scope: scopes!,
},
});
};

return (
<Button className="w-full" disabled={!user}>
<Button
className="w-full"
disabled={!user || isPending}
onClick={handleConfirm}
>
{isPending && <span className="loading loading-spinner"></span>}
Продовжити
</Button>
);
Expand Down

0 comments on commit e78cb17

Please sign in to comment.