UNPKG

@asgardeo/browser

Version:

Browser-specific implementation of Asgardeo JavaScript SDK.

43 lines (42 loc) 2.13 kB
/** * Copyright (c) 2020-2024, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import { AxiosRequestConfig } from 'axios'; import { HttpClientInstance, HttpError, HttpResponse } from '.'; import { SPACustomGrantConfig } from '../..'; export interface HttpClient { requestStartCallback: () => void; requestSuccessCallback: (response: HttpResponse) => void; requestErrorCallback: (error: HttpError) => void | Promise<void>; requestFinishCallback: () => void; } export interface HttpRequestInterface { httpClient: HttpClientInstance; requestConfig: HttpRequestConfig; isHttpHandlerEnabled?: boolean; httpErrorCallback?: (error: HttpError) => void | Promise<void>; httpFinishCallback?: () => void; enableRetrievingSignOutURLFromSession?: (config: SPACustomGrantConfig) => void; } export interface HttpRequestConfig extends AxiosRequestConfig, Omit<Request, 'headers' | 'method' | 'signal' | 'url'> { attachToken?: boolean; shouldEncodeToFormData?: boolean; shouldAttachIDPAccessToken?: boolean; startTimeInMs?: number; } export { AxiosResponse as HttpResponse, Method as HttpMethod, AxiosRequestTransformer as HttpRequestTransformer, AxiosResponseTransformer as HttpResponseTransformer, AxiosAdapter as HttpAdapter, AxiosBasicCredentials as HttpBasicCredentials, ResponseType, AxiosProxyConfig as HttpProxyConfig, CancelToken, AxiosError as HttpError, AxiosPromise as HttpPromise, AxiosInstance as HttpInstance, } from 'axios'; export { HttpClientInstance } from '../http-client';