修复一些问题

This commit is contained in:
海龙 2025-08-30 14:55:44 +08:00
parent b4d17d237b
commit 0e381bae0d
5 changed files with 39 additions and 16 deletions

View File

@ -83,6 +83,7 @@ function HomeModule5() {
credits: string;
buttonText: string;
features: string[];
issubscribed: boolean;
}[]
>(() => {
return plans.map((plan) => {
@ -94,6 +95,7 @@ function HomeModule5() {
: plan.price_year / 100,
credits: plan.description,
buttonText: plan.is_free ? "Try For Free" : "Subscribe Now",
issubscribed: plan.is_subscribed,
features: plan.features || [],
};
});
@ -191,12 +193,21 @@ function HomeModule5() {
<p className="text-white text-[0.875rem] mb-[1rem]">
{plan.credits}
</p>
{plan.issubscribed ? (
<button
disabled
className="w-full bg-gray-400 text-gray-600 py-[0.75rem] rounded-full mb-[1rem] cursor-not-allowed border border-gray-300"
>
Already Owned
</button>
) : (
<button
onClick={() => handleSubscribe(plan.title)}
className="w-full bg-white text-black py-[0.75rem] rounded-full mb-[1rem] hover:bg-black hover:text-white transition-colors border border-white/20"
>
{plan.buttonText}
</button>
)}
<p className="w-full text-center text-white/60 text-[0.75rem] mb-[2rem]">
* Billed monthly until cancelled
</p>

View File

@ -124,7 +124,7 @@ export default function SignupPage() {
router.push("/login?registered=true");
} catch (error: any) {
console.error("Signup error:", error);
setFormError(error.message || "Registration failed, please try again");
setFormError(error.msg || "Registration failed, please try again");
} finally {
setIsSubmitting(false);
}
@ -301,10 +301,10 @@ export default function SignupPage() {
id="agreeToTerms"
checked={agreeToTerms}
onChange={(e) => setAgreeToTerms(e.target.checked)}
className="mt-1 w-4 h-4 text-purple-600 bg-black/30 border-white/20 rounded focus:ring-purple-500 focus:ring-2"
className="cursor-pointer mt-1 w-4 h-4 text-purple-600 bg-black/30 border-white/20 rounded focus:ring-purple-500 focus:ring-2"
/>
<label htmlFor="agreeToTerms" className="text-sm text-gray-300 leading-relaxed">
I agree to the{" "}
By registering, you agree to our{" "}
<button
type="button"
onClick={handleTermsClick}

View File

@ -569,6 +569,7 @@ function HomeModule5() {
credits: string;
buttonText: string;
features: string[];
issubscribed: boolean;
}[]
>(() => {
return plans.map((plan) => {
@ -580,6 +581,7 @@ function HomeModule5() {
: plan.price_year / 100,
credits: plan.description,
buttonText: plan.is_free ? "Try For Free" : "Subscribe Now",
issubscribed: plan.is_subscribed,
features: plan.features || [],
};
});
@ -679,12 +681,21 @@ function HomeModule5() {
<p className="text-white text-[0.875rem] mb-[1rem]">
{plan.credits}
</p>
{plan.issubscribed ? (
<button
disabled
className="w-full bg-gray-400 text-gray-600 py-[0.75rem] rounded-full mb-[1rem] cursor-not-allowed border border-gray-300"
>
Already Owned
</button>
) : (
<button
onClick={() => handleSubscribe(plan.title)}
className="w-full bg-white text-black py-[0.75rem] rounded-full mb-[1rem] hover:bg-black hover:text-white transition-colors border border-white/20"
>
{plan.buttonText}
</button>
)}
<p className="w-full text-center text-white/60 text-[0.75rem] mb-[2rem]">
* Billed monthly until cancelled
</p>

View File

@ -380,7 +380,7 @@ export const registerUser = async ({
const data = await response.json();
console.log('data', data)
if(!data.success){
throw new Error(data.message)
throw new Error(data.msg)
}
return data as {
success: boolean;

View File

@ -14,6 +14,7 @@ export interface SubscriptionPlan {
features: string[];
is_free: boolean;
is_popular: boolean;
is_subscribed: boolean;
sort_order: number;
}