From 21508a3514500f8f38ddaa8bef7a9cd420d76628 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Mon, 22 May 2023 21:18:20 -0600 Subject: AƱade carrito MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/clients/actions.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/clients/actions.ts') diff --git a/src/clients/actions.ts b/src/clients/actions.ts index acc5ad3..cee9a85 100644 --- a/src/clients/actions.ts +++ b/src/clients/actions.ts @@ -56,13 +56,15 @@ export async function authenticatedEdit({ request }) { } } -export async function createAddress({ request }) { +export async function create({ request }) { clearSessionStorage(); const client = new ApiClient(); + const paths = new URL(request.url).pathname.split('/'); + const request_path = paths.slice(0, paths.length - 1).join('/'); const form_data = await request.formData(); try{ - await client.post('/account/addresses', form_data, client.authorizationHeaders()); + await client.post(request_path, form_data, client.authorizationHeaders()); return redirect("/account"); } catch(error) { -- cgit v1.2.3