feat: integrate oauth store in authorize page
This commit is contained in:
@ -5,20 +5,20 @@ import { ArrowLeftRight, ChevronDown } from "lucide-react";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import Avatar from "@/feature/Avatar";
|
import Avatar from "@/feature/Avatar";
|
||||||
import { useAuth } from "@/store/auth";
|
import { useAuth } from "@/store/auth";
|
||||||
import { useOAuthContext } from "@/context/oauth";
|
import { useOAuth } from "@/store/oauth";
|
||||||
|
|
||||||
const AuthorizePage: FC = () => {
|
const AuthorizePage: FC = () => {
|
||||||
const promptAccountSelection = useAuth((state) => state.deleteActiveAccount);
|
const promptAccountSelection = useAuth((state) => state.deleteActiveAccount);
|
||||||
const activeAccount = useAuth((state) => state.activeAccount);
|
const activeAccount = useAuth((state) => state.activeAccount);
|
||||||
|
|
||||||
const oauth = useOAuthContext();
|
|
||||||
|
|
||||||
const profile = useAuth((state) => state.profile);
|
const profile = useAuth((state) => state.profile);
|
||||||
|
|
||||||
|
const selectSession = useOAuth((state) => state.selectSession);
|
||||||
|
|
||||||
const handleAgree = useCallback(() => {
|
const handleAgree = useCallback(() => {
|
||||||
if (!activeAccount) return;
|
if (!activeAccount) return;
|
||||||
oauth.selectSession(activeAccount.access);
|
selectSession(activeAccount.access);
|
||||||
}, [activeAccount, oauth]);
|
}, [activeAccount, selectSession]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
Reference in New Issue
Block a user