fix:google login

This commit is contained in:
xuqssq
2024-12-21 20:52:48 +08:00
parent 3812c9b7e9
commit 36db1f29b0
6 changed files with 4421 additions and 70 deletions

View File

@@ -1,11 +1,11 @@
import React from 'react';
import { Navigate } from 'react-router-dom';
import { Navigate,useLocation } from 'react-router-dom';
import { useAuth } from '@/contexts/AuthContext';
import { Spin } from 'antd';
export const ProtectedRoute = ({ children }) => {
const { user, loading } = useAuth();
const location = useLocation();
if (loading) {
return (
<div className="min-h-screen flex items-center justify-center">
@@ -15,7 +15,7 @@ export const ProtectedRoute = ({ children }) => {
}
if (!user) {
return <Navigate to="/login" replace />;
return <Navigate to={`/login`} replace />;
}
return children;