Feat(medusajs) Allow to pass custom headers (#1009)
* Feat(medusajs) Allow to pass custom headers * fix: axios exprexted output * fix: integration test cart * refactor: Update types object > Record<string, any> Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
This commit is contained in:
co-authored by
Sebastian Rindom
parent
449e666428
commit
22d387dcce
@@ -10,31 +10,34 @@ class AuthResource extends BaseResource {
|
||||
/**
|
||||
* @description Authenticates a customer using email and password combination
|
||||
* @param {StorePostAuthReq} payload authentication payload
|
||||
* @param customHeaders
|
||||
* @return {ResponsePromise<StoreAuthRes>}
|
||||
*/
|
||||
authenticate(payload: StorePostAuthReq): ResponsePromise<StoreAuthRes> {
|
||||
authenticate(payload: StorePostAuthReq, customHeaders: Record<string, any> = {}): ResponsePromise<StoreAuthRes> {
|
||||
const path = `/store/auth`
|
||||
return this.client.request("POST", path, payload)
|
||||
return this.client.request("POST", path, payload, {}, customHeaders)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Retrieves an authenticated session
|
||||
* Usually used to check if authenticated session is alive.
|
||||
* @param customHeaders
|
||||
* @return {ResponsePromise<StoreAuthRes>}
|
||||
*/
|
||||
getSession(): ResponsePromise<StoreAuthRes> {
|
||||
getSession(customHeaders: Record<string, any> = {}): ResponsePromise<StoreAuthRes> {
|
||||
const path = `/store/auth`
|
||||
return this.client.request("GET", path)
|
||||
return this.client.request("GET", path, {}, {}, customHeaders)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Check if email exists
|
||||
* @param {string} email is required
|
||||
* @param customHeaders
|
||||
* @return {ResponsePromise<StoreGetAuthEmailRes>}
|
||||
*/
|
||||
exists(email: string): ResponsePromise<StoreGetAuthEmailRes> {
|
||||
exists(email: string, customHeaders: Record<string, any> = {}): ResponsePromise<StoreGetAuthEmailRes> {
|
||||
const path = `/store/auth/${email}`
|
||||
return this.client.request("GET", path)
|
||||
return this.client.request("GET", path, {}, {}, customHeaders)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user