mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-11 00:08:37 +01:00
new selfhosted version
This commit is contained in:
19
dashboard/server/api/user/customer.ts
Normal file
19
dashboard/server/api/user/customer.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
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;
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user