@sassoftware/af-axios
Advanced tools
Comparing version 0.4.1 to 0.5.0
{ | ||
"name": "@sassoftware/af-axios", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "Minimal Axios HTTP client wrapper with SAS authentication support", | ||
@@ -5,0 +5,0 @@ "author": "SAS", |
@@ -1,4 +0,5 @@ | ||
import { ReactNode } from 'react'; | ||
import { type AxiosRequestConfig } from 'axios'; | ||
import { type ReactNode } from 'react'; | ||
import { useMsalAuthentication } from '@azure/msal-react'; | ||
import { AuthError, RedirectRequest, SilentRequest } from '@azure/msal-browser'; | ||
import { type AuthError, type RedirectRequest, type SilentRequest } from '@azure/msal-browser'; | ||
interface AuthContextProviderProps { | ||
@@ -11,5 +12,6 @@ children: ReactNode; | ||
errorElement?: ReactNode; | ||
axiosConfig?: AxiosRequestConfig; | ||
} | ||
declare const Auth: ({ children, onAuthError, authenticationRequest, accountIdentifiers, loadingElement, errorElement, }: AuthContextProviderProps) => JSX.Element; | ||
declare const Auth: ({ children, onAuthError, authenticationRequest, accountIdentifiers, loadingElement, errorElement, axiosConfig, }: AuthContextProviderProps) => JSX.Element; | ||
export default Auth; | ||
//# sourceMappingURL=Auth.d.ts.map |
@@ -20,6 +20,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import AxiosInstanceContext from './AxiosInstanceContext'; | ||
const Auth = ({ children, onAuthError, authenticationRequest, accountIdentifiers, loadingElement, errorElement, }) => { | ||
const Auth = ({ children, onAuthError, authenticationRequest, accountIdentifiers, loadingElement, errorElement, axiosConfig, }) => { | ||
const { instance: msalInstance } = useMsal(); | ||
const { error } = useMsalAuthentication(InteractionType.Redirect, authenticationRequest, accountIdentifiers); | ||
const axiosInstance = useMemo(() => axios.create(), []); | ||
const axiosInstance = useMemo(() => axios.create(axiosConfig), []); | ||
const isAuthenticated = useIsAuthenticated(); | ||
@@ -26,0 +26,0 @@ const context = useMsal(); |
@@ -5,2 +5,4 @@ /* | ||
*/ | ||
import * as axios from 'axios'; | ||
import { AxiosRequestConfig, AxiosInstance } from 'axios'; | ||
import * as react from 'react'; | ||
@@ -10,4 +12,2 @@ import { ReactNode } from 'react'; | ||
import { AuthError, RedirectRequest, SilentRequest } from '@azure/msal-browser'; | ||
import * as axios from 'axios'; | ||
import { AxiosInstance } from 'axios'; | ||
@@ -21,4 +21,5 @@ interface AuthContextProviderProps { | ||
errorElement?: ReactNode; | ||
axiosConfig?: AxiosRequestConfig; | ||
} | ||
declare const Auth: ({ children, onAuthError, authenticationRequest, accountIdentifiers, loadingElement, errorElement, }: AuthContextProviderProps) => JSX.Element; | ||
declare const Auth: ({ children, onAuthError, authenticationRequest, accountIdentifiers, loadingElement, errorElement, axiosConfig, }: AuthContextProviderProps) => JSX.Element; | ||
@@ -25,0 +26,0 @@ declare const useAxios: () => axios.AxiosInstance; |
@@ -60,3 +60,4 @@ /* | ||
loadingElement, | ||
errorElement | ||
errorElement, | ||
axiosConfig | ||
}) => { | ||
@@ -69,3 +70,3 @@ const { instance: msalInstance } = msalReact.useMsal(); | ||
); | ||
const axiosInstance = react.useMemo(() => axios.create(), []); | ||
const axiosInstance = react.useMemo(() => axios.create(axiosConfig), []); | ||
const isAuthenticated = msalReact.useIsAuthenticated(); | ||
@@ -72,0 +73,0 @@ const context = msalReact.useMsal(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
40893
395