Reverted to edit edt-5621e5a0-bf01-45d1-871d-f401b7a23641: "Investigate fetch failure
Investigate why fetch requests are failing."
This commit is contained in:
@@ -4,7 +4,7 @@ import { createClient } from '@supabase/supabase-js';
|
|||||||
// Supabase URL과 anon key 설정
|
// Supabase URL과 anon key 설정
|
||||||
// 브라우저에서 CORS 문제가 자주 발생하므로 HTTPS URL로 변경
|
// 브라우저에서 CORS 문제가 자주 발생하므로 HTTPS URL로 변경
|
||||||
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || 'https://tzmywjqtluhwemhuflhi.supabase.co';
|
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || 'https://tzmywjqtluhwemhuflhi.supabase.co';
|
||||||
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY || 'yQKSViIU5I2/QTbTN93GnGxKC+Ny3KPE+gDhrMzlhG0=';
|
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY || 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InR6bXl3anF0bHVod2VtaHVmbGhpIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDk1NDUzMTUsImV4cCI6MjAyNTEyMTMxNX0.iCPZvMm9KeRjxh2cE-rkpAIxf9XpZzGIpSZBXBSRfoU';
|
||||||
|
|
||||||
// 유효한 URL이 설정되었는지 확인
|
// 유효한 URL이 설정되었는지 확인
|
||||||
const isValidUrl = supabaseUrl && supabaseAnonKey &&
|
const isValidUrl = supabaseUrl && supabaseAnonKey &&
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { ArrowRight, Mail, KeyRound, User, Eye, EyeOff } from "lucide-react";
|
import { ArrowRight, Mail, KeyRound, User, Eye, EyeOff } from "lucide-react";
|
||||||
import { useToast } from "@/hooks/useToast.wrapper";
|
import { useToast } from "@/hooks/useToast.wrapper";
|
||||||
import { useAuth } from "@/contexts/auth";
|
import { useAuth } from "@/contexts/auth";
|
||||||
|
|
||||||
const Register = () => {
|
const Register = () => {
|
||||||
const [username, setUsername] = useState("");
|
const [username, setUsername] = useState("");
|
||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
@@ -13,45 +14,43 @@ const Register = () => {
|
|||||||
const [confirmPassword, setConfirmPassword] = useState("");
|
const [confirmPassword, setConfirmPassword] = useState("");
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const {
|
const { toast } = useToast();
|
||||||
toast
|
|
||||||
} = useToast();
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const {
|
const { signUp, user } = useAuth();
|
||||||
signUp,
|
|
||||||
user
|
|
||||||
} = useAuth();
|
|
||||||
|
|
||||||
// 이미 로그인된 경우 메인 페이지로 리다이렉트
|
// 이미 로그인된 경우 메인 페이지로 리다이렉트
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (user) {
|
if (user) {
|
||||||
navigate("/");
|
navigate("/");
|
||||||
}
|
}
|
||||||
}, [user, navigate]);
|
}, [user, navigate]);
|
||||||
|
|
||||||
const handleRegister = async (e: React.FormEvent) => {
|
const handleRegister = async (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (!username || !email || !password || !confirmPassword) {
|
if (!username || !email || !password || !confirmPassword) {
|
||||||
toast({
|
toast({
|
||||||
title: "입력 오류",
|
title: "입력 오류",
|
||||||
description: "모든 필드를 입력해주세요.",
|
description: "모든 필드를 입력해주세요.",
|
||||||
variant: "destructive"
|
variant: "destructive",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (password !== confirmPassword) {
|
if (password !== confirmPassword) {
|
||||||
toast({
|
toast({
|
||||||
title: "비밀번호 불일치",
|
title: "비밀번호 불일치",
|
||||||
description: "비밀번호와 비밀번호 확인이 일치하지 않습니다.",
|
description: "비밀번호와 비밀번호 확인이 일치하지 않습니다.",
|
||||||
variant: "destructive"
|
variant: "destructive",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const {
|
const { error, user } = await signUp(email, password, username);
|
||||||
error,
|
|
||||||
user
|
|
||||||
} = await signUp(email, password, username);
|
|
||||||
if (!error && user) {
|
if (!error && user) {
|
||||||
// 데모 모드에서는 즉시 메인 페이지로 이동
|
// 데모 모드에서는 즉시 메인 페이지로 이동
|
||||||
navigate("/");
|
navigate("/");
|
||||||
@@ -62,10 +61,12 @@ const Register = () => {
|
|||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return <div className="min-h-screen flex flex-col items-center justify-center p-6 bg-neuro-background">
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen flex flex-col items-center justify-center p-6 bg-neuro-background">
|
||||||
<div className="w-full max-w-md">
|
<div className="w-full max-w-md">
|
||||||
<div className="text-center mb-8">
|
<div className="text-center mb-8">
|
||||||
<h1 className="text-3xl font-bold text-neuro-income mb-2">젤리의 적자 탈출</h1>
|
<h1 className="text-3xl font-bold text-neuro-income mb-2">젤리의 적자탈출</h1>
|
||||||
<p className="text-gray-500">새 계정을 만들고 재정 관리를 시작하세요</p>
|
<p className="text-gray-500">새 계정을 만들고 재정 관리를 시작하세요</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -76,7 +77,14 @@ const Register = () => {
|
|||||||
<Label htmlFor="username" className="text-base">이름</Label>
|
<Label htmlFor="username" className="text-base">이름</Label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<User className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
|
<User className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
|
||||||
<Input id="username" type="text" placeholder="홍길동" value={username} onChange={e => setUsername(e.target.value)} className="pl-10 neuro-pressed" />
|
<Input
|
||||||
|
id="username"
|
||||||
|
type="text"
|
||||||
|
placeholder="홍길동"
|
||||||
|
value={username}
|
||||||
|
onChange={(e) => setUsername(e.target.value)}
|
||||||
|
className="pl-10 neuro-pressed"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -84,7 +92,14 @@ const Register = () => {
|
|||||||
<Label htmlFor="email" className="text-base">이메일</Label>
|
<Label htmlFor="email" className="text-base">이메일</Label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Mail className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
|
<Mail className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
|
||||||
<Input id="email" type="email" placeholder="your@email.com" value={email} onChange={e => setEmail(e.target.value)} className="pl-10 neuro-pressed" />
|
<Input
|
||||||
|
id="email"
|
||||||
|
type="email"
|
||||||
|
placeholder="your@email.com"
|
||||||
|
value={email}
|
||||||
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
|
className="pl-10 neuro-pressed"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -92,8 +107,19 @@ const Register = () => {
|
|||||||
<Label htmlFor="password" className="text-base">비밀번호</Label>
|
<Label htmlFor="password" className="text-base">비밀번호</Label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<KeyRound className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
|
<KeyRound className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
|
||||||
<Input id="password" type={showPassword ? "text" : "password"} placeholder="••••••••" value={password} onChange={e => setPassword(e.target.value)} className="pl-10 neuro-pressed" />
|
<Input
|
||||||
<button type="button" onClick={() => setShowPassword(!showPassword)} className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500">
|
id="password"
|
||||||
|
type={showPassword ? "text" : "password"}
|
||||||
|
placeholder="••••••••"
|
||||||
|
value={password}
|
||||||
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
|
className="pl-10 neuro-pressed"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowPassword(!showPassword)}
|
||||||
|
className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500"
|
||||||
|
>
|
||||||
{showPassword ? <EyeOff className="h-5 w-5" /> : <Eye className="h-5 w-5" />}
|
{showPassword ? <EyeOff className="h-5 w-5" /> : <Eye className="h-5 w-5" />}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -103,11 +129,22 @@ const Register = () => {
|
|||||||
<Label htmlFor="confirmPassword" className="text-base">비밀번호 확인</Label>
|
<Label htmlFor="confirmPassword" className="text-base">비밀번호 확인</Label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<KeyRound className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
|
<KeyRound className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
|
||||||
<Input id="confirmPassword" type={showPassword ? "text" : "password"} placeholder="••••••••" value={confirmPassword} onChange={e => setConfirmPassword(e.target.value)} className="pl-10 neuro-pressed" />
|
<Input
|
||||||
|
id="confirmPassword"
|
||||||
|
type={showPassword ? "text" : "password"}
|
||||||
|
placeholder="••••••••"
|
||||||
|
value={confirmPassword}
|
||||||
|
onChange={(e) => setConfirmPassword(e.target.value)}
|
||||||
|
className="pl-10 neuro-pressed"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button type="submit" className="w-full bg-neuro-income hover:bg-neuro-income/80 text-white py-6 h-auto" disabled={isLoading}>
|
<Button
|
||||||
|
type="submit"
|
||||||
|
className="w-full bg-neuro-income hover:bg-neuro-income/80 text-white py-6 h-auto"
|
||||||
|
disabled={isLoading}
|
||||||
|
>
|
||||||
{isLoading ? "가입 중..." : "회원가입"} {!isLoading && <ArrowRight className="ml-2 h-5 w-5" />}
|
{isLoading ? "가입 중..." : "회원가입"} {!isLoading && <ArrowRight className="ml-2 h-5 w-5" />}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -123,6 +160,8 @@ const Register = () => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
export default Register;
|
|
||||||
|
export default Register;
|
||||||
|
|||||||
Reference in New Issue
Block a user