Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request #100 from magopian/flow-bituary-bis
Browse files Browse the repository at this point in the history
Remove some leftover flow type annotations
  • Loading branch information
rehandalal committed Apr 6, 2018
2 parents 9534427 + c670808 commit 7008765
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/console/auth0Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ export const AUTH0_CLIENT_ID = 'WYRYpJyS5DnDyxLTRVGCQGCWGo2KNQLN';
export const AUTH0_DOMAIN = 'minimal-demo-iam.auth0.com';
export const AUTH0_CALLBACK_URL = window.location.href;

export function webAuthHandler(
callback: AuthResult => void,
err: string,
authResult: AuthResult,
) {
export function webAuthHandler(callback, err, authResult) {
if (err) {
throw new Error(err);
}
Expand All @@ -33,7 +29,7 @@ export function initWebAuth() {
return webAuth;
}

export function setSession(authResult: AuthResult) {
export function setSession(authResult) {
// Set the time that the access token will expire at.
const expiresAt = JSON.stringify(
authResult.expiresIn * 1000 + new Date().getTime(),
Expand All @@ -42,7 +38,7 @@ export function setSession(authResult: AuthResult) {
localStorage.setItem('expires_at', expiresAt);
}

export function login(initFunc: () => WebAuth = initWebAuth) {
export function login(initFunc = initWebAuth) {
const webAuth = initFunc();
webAuth.authorize();
}
Expand All @@ -55,9 +51,9 @@ export function logout() {

// Check if the user has logged in.
export function checkLogin(
onLoggedIn: () => void,
initFunc: () => WebAuth = initWebAuth,
handler: HashParser = webAuthHandler,
onLoggedIn,
initFunc = initWebAuth,
handler = webAuthHandler,
) {
try {
if (!handler) {
Expand All @@ -81,11 +77,7 @@ export function isAuthenticated() {
return new Date().getTime() < expiresAt;
}

export function handleUserInfo(
onUserInfo: UserInfo => void,
err: string,
profile: UserInfo,
) {
export function handleUserInfo(onUserInfo, err, profile) {
if (err) {
throw new Error(err);
}
Expand All @@ -94,10 +86,7 @@ export function handleUserInfo(
}
}

export function fetchUserInfo(
callback: (string, UserInfo) => void,
initFunc: () => WebAuth = initWebAuth,
) {
export function fetchUserInfo(callback, initFunc = initWebAuth) {
const session = localStorage.getItem('session');
if (!session) {
return;
Expand Down

0 comments on commit 7008765

Please sign in to comment.