react-thau
Advanced tools
Comparing version 1.0.5-beta.0 to 1.0.5-beta.1
@@ -1,2 +0,18 @@ | ||
declare const useAuth: () => import("../context").AuthContextType; | ||
declare const useAuth: () => { | ||
loading: boolean; | ||
error: Error | null; | ||
availableStrategies: string[] | null; | ||
tokenStorage: "localStorage" | "cookie"; | ||
google?: { | ||
clientId: string; | ||
} | undefined; | ||
facebook?: { | ||
clientId: string; | ||
graphVersion: string; | ||
} | undefined; | ||
setUser: (u?: import("../types").User | undefined, p?: string | undefined) => void; | ||
user?: import("../types").User | undefined; | ||
provider?: string | undefined; | ||
authUrl?: string | undefined; | ||
}; | ||
export default useAuth; |
import { createContext, useContext, useReducer, useEffect, useState, createElement } from 'react'; | ||
var authContext = createContext({ | ||
loading: false, | ||
error: null, | ||
availableStrategies: null, | ||
tokenStorage: 'localStorage', | ||
setUser: function () { }, | ||
}); | ||
var useAuth = function () { | ||
var auth = useContext(authContext); | ||
delete auth.authUrl; | ||
return auth; | ||
}; | ||
/*! ***************************************************************************** | ||
@@ -81,2 +67,16 @@ Copyright (c) Microsoft Corporation. | ||
var authContext = createContext({ | ||
loading: false, | ||
error: null, | ||
availableStrategies: null, | ||
tokenStorage: 'localStorage', | ||
setUser: function () { }, | ||
}); | ||
var useAuth = function () { | ||
var auth = __assign({}, useContext(authContext)); | ||
delete auth.authUrl; | ||
return auth; | ||
}; | ||
var APIError = /** @class */ (function () { | ||
@@ -83,0 +83,0 @@ function APIError(message, status) { |
@@ -7,16 +7,2 @@ 'use strict'; | ||
var authContext = React.createContext({ | ||
loading: false, | ||
error: null, | ||
availableStrategies: null, | ||
tokenStorage: 'localStorage', | ||
setUser: function () { }, | ||
}); | ||
var useAuth = function () { | ||
var auth = React.useContext(authContext); | ||
delete auth.authUrl; | ||
return auth; | ||
}; | ||
/*! ***************************************************************************** | ||
@@ -86,2 +72,16 @@ Copyright (c) Microsoft Corporation. | ||
var authContext = React.createContext({ | ||
loading: false, | ||
error: null, | ||
availableStrategies: null, | ||
tokenStorage: 'localStorage', | ||
setUser: function () { }, | ||
}); | ||
var useAuth = function () { | ||
var auth = __assign({}, React.useContext(authContext)); | ||
delete auth.authUrl; | ||
return auth; | ||
}; | ||
var APIError = /** @class */ (function () { | ||
@@ -88,0 +88,0 @@ function APIError(message, status) { |
{ | ||
"name": "react-thau", | ||
"version": "1.0.5-beta.0", | ||
"version": "1.0.5-beta.1", | ||
"description": "React thau client.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -5,3 +5,3 @@ import * as React from 'react' | ||
const useAuth = () => { | ||
const auth = React.useContext(authContext) | ||
const auth = { ...React.useContext(authContext) } | ||
delete auth.authUrl | ||
@@ -8,0 +8,0 @@ |
@@ -139,2 +139,3 @@ import * as React from 'react' | ||
const auth = React.useContext(authContext) | ||
const [state, dispatch] = React.useReducer(reducer, initialState) | ||
@@ -141,0 +142,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
259382
3076