mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
19 lines
497 B
TypeScript
19 lines
497 B
TypeScript
|
|
import { PremiumModel } from '~/shared/schema/PremiumSchema';
|
|
|
|
export default defineEventHandler(async event => {
|
|
|
|
const ctx = await getRequestContext(event);
|
|
|
|
const { user_id } = ctx;
|
|
|
|
const premium = await PremiumModel.findOne({ user_id })
|
|
if (!premium) throw createError({ status: 400, message: 'Error getting user. Please contact support.' });
|
|
|
|
const { payments } = useTRPC();
|
|
|
|
const customer = await payments.customer.get.query({ user_id })
|
|
|
|
return customer;
|
|
|
|
}); |