Skip to content

Commit

Permalink
chore: bring back updateCustomer
Browse files Browse the repository at this point in the history
  • Loading branch information
VariableVic committed Nov 22, 2024
1 parent e0969bb commit 643905a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/lib/data/customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import medusaError from "@lib/util/medusa-error"
import { HttpTypes } from "@medusajs/types"
import { revalidateTag } from "next/cache"
import { redirect } from "next/navigation"
import { cache } from "react"
import {
getAuthHeaders,
getCacheOptions,
Expand Down Expand Up @@ -37,6 +36,22 @@ export const retrieveCustomer =
.catch(() => null)
}

export const updateCustomer = async (body: HttpTypes.StoreUpdateCustomer) => {
const headers = {
...(await getAuthHeaders()),
}

const updateRes = await sdk.store.customer
.update(body, {}, headers)
.then(({ customer }) => customer)
.catch(medusaError)

const cacheTag = await getCacheTag("customers")
revalidateTag(cacheTag)

return updateRes
}

export async function signup(_currentState: unknown, formData: FormData) {
const password = formData.get("password") as string
const customerForm = {
Expand Down

0 comments on commit 643905a

Please sign in to comment.