mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
new selfhosted version
This commit is contained in:
18
dashboard/server/api/user/update_customer.post.ts
Normal file
18
dashboard/server/api/user/update_customer.post.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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 body = await readBody(event);
|
||||
|
||||
const { payments } = useTRPC();
|
||||
|
||||
const result = await payments.customer.update.mutate({ user_id, address: body });
|
||||
return result;
|
||||
});
|
||||
Reference in New Issue
Block a user