Remove email query parameter from subscription patch api

This commit is contained in:
sabaimran 2024-11-11 21:39:49 -08:00
parent d7027109a5
commit 47d3c8c235
2 changed files with 3 additions and 2 deletions

View file

@ -594,7 +594,7 @@ export default function SettingsView() {
const setSubscription = async (state: string) => { const setSubscription = async (state: string) => {
try { try {
const url = `/api/subscription?email=${userConfig?.username}&operation=${state}`; const url = `/api/subscription?operation=${state}`;
const response = await fetch(url, { const response = await fetch(url, {
method: "PATCH", method: "PATCH",
headers: { headers: {

View file

@ -94,8 +94,9 @@ async def subscribe(request: Request):
@subscription_router.patch("") @subscription_router.patch("")
@requires(["authenticated"]) @requires(["authenticated"])
async def update_subscription(request: Request, email: str, operation: str): async def update_subscription(request: Request, operation: str):
# Retrieve the customer's details # Retrieve the customer's details
email = request.user.object.email
customers = stripe.Customer.list(email=email).auto_paging_iter() customers = stripe.Customer.list(email=email).auto_paging_iter()
customer = next(customers, None) customer = next(customers, None)
if customer is None: if customer is None: