Skip to content

Commit

Permalink
udpate user_email
Browse files Browse the repository at this point in the history
  • Loading branch information
idoubi committed Apr 14, 2024
1 parent ae73dca commit afe020e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/[locale]/(default)/_components/generator/describe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ export default function () {
} catch (e) {
setLoading(false);

console.log("gen lyrics failed:", e);
toast.error("generate lyrics failed");
console.log("gen song failed:", e);
toast.error("generate song failed");
}
};

Expand Down
16 changes: 13 additions & 3 deletions app/api/checkout/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { respData, respErr } from "@/utils/resp";

import { Order } from "@/types/order";
import Stripe from "stripe";
import { findUserByUuid } from "@/models/user";
import { genOrderNo } from "@/utils/order";

export const maxDuration = 120;
Expand All @@ -20,12 +21,21 @@ export async function POST(req: Request) {
}

const user_uuid = await getUserUuid();
const user_email = await getUserEmail();
console.log("user", user_email, user_uuid);
if (!user_uuid || !user_email) {
if (!user_uuid) {
return respErr("no auth");
}

let user_email = await getUserEmail();
if (!user_email) {
const user = await findUserByUuid(user_uuid);
if (user) {
user_email = user.email;
}
}
if (!user_email) {
return respErr("invalid user");
}

const order_no = genOrderNo();

const currentDate = new Date();
Expand Down

0 comments on commit afe020e

Please sign in to comment.