mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Don't set config from OAuth callbacks until after it has been loaded
This commit is contained in:
11 files changed
+49
-194
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useSearchParams, useNavigate } from 'react-router-dom';
|
||||
import { useNetlifyOAuth } from '@/hooks/useNetlifyOAuth';
|
||||
import { useDeploySettings } from '@/hooks/useDeploySettings';
|
||||
import { useToast } from '@/hooks/useToast';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
@@ -8,9 +9,15 @@ export default function NetlifyOAuth() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const navigate = useNavigate();
|
||||
const { handleCallback } = useNetlifyOAuth();
|
||||
const { isInitialized } = useDeploySettings();
|
||||
const { toast } = useToast();
|
||||
|
||||
useEffect(() => {
|
||||
// Wait for deploy settings to be initialized
|
||||
if (!isInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
const code = searchParams.get('code');
|
||||
const state = searchParams.get('state');
|
||||
const error = searchParams.get('error');
|
||||
@@ -50,7 +57,7 @@ export default function NetlifyOAuth() {
|
||||
// No code or state parameters - redirect to Deploy settings
|
||||
navigate('/settings/deploy');
|
||||
}
|
||||
}, [searchParams, handleCallback, toast, navigate]);
|
||||
}, [searchParams, handleCallback, toast, navigate, isInitialized]);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center p-4">
|
||||
|
||||
Reference in new issue
Block a user