Skip to content

Commit

Permalink
PR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anku255 committed Dec 7, 2023
1 parent 3877f51 commit 104a2b0
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 32 deletions.
5 changes: 1 addition & 4 deletions lib/ts/recipe/recipeModule/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ export type RecipePostAPIHookFunction<Action> = (context: RecipePostAPIHookConte
export type RecipeOnHandleEventFunction<EventType> = (context: EventType) => void;

export type UserInput<GetRedirectionURLContextType, Action, OnHandleEventContextType> = {
getRedirectionURL?: (
context: GetRedirectionURLContextType,
userContext: any
) => Promise<string | undefined | null>;
getRedirectionURL?: (context: GetRedirectionURLContextType, userContext: any) => Promise<string | undefined | null>;
preAPIHook?: RecipePreAPIHookFunction<Action>;
postAPIHook?: RecipePostAPIHookFunction<Action>;
onHandleEvent?: RecipeOnHandleEventFunction<OnHandleEventContextType>;
Expand Down
12 changes: 0 additions & 12 deletions lib/ts/recipe/session/recipe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import SessionWebJS from "supertokens-web-js/recipe/session";
import WebJSSessionRecipe from "supertokens-web-js/recipe/session";

import { logDebugMessage } from "../../logger";
import SuperTokens from "../../superTokens";
import { getLocalStorage, isTest, removeFromLocalStorage, setLocalStorage } from "../../utils";
import RecipeModule from "../recipeModule";
Expand Down Expand Up @@ -166,17 +165,6 @@ export default class Session extends RecipeModule<unknown, unknown, unknown, Nor
userContext,
});

if (failureRedirectInfo.redirectPath === null) {
logDebugMessage(
`Skipping redirection because the user override returned null for validator ${JSON.stringify(
failureRedirectInfo.failedClaim,
null,
2
)}`
);
return;
}

// if redirectPath is string that means failed claim had callback that returns path, we redirect there otherwise continue
if (failureRedirectInfo.redirectPath !== undefined) {
return SuperTokens.getInstanceOrThrow().redirectToUrl(failureRedirectInfo.redirectPath, navigate);
Expand Down
13 changes: 0 additions & 13 deletions lib/ts/recipe/session/sessionAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
import React, { useEffect, useState, useRef, useCallback } from "react";

import { logDebugMessage } from "../../logger";
import SuperTokens from "../../superTokens";
import UI from "../../ui";
import { useUserContext } from "../../usercontext";
Expand Down Expand Up @@ -187,18 +186,6 @@ const SessionAuth: React.FC<PropsWithChildren<SessionAuthProps>> = ({ children,
userContext,
});

if (failureRedirectInfo.redirectPath === null) {
setContext(toSetContext);
logDebugMessage(
`Skipping redirection because the user override returned null for validator ${JSON.stringify(
failureRedirectInfo.failedClaim,
null,
2
)}`
);
return;
}

if (failureRedirectInfo.redirectPath !== undefined) {
setContext(toSetContext);
return await SuperTokens.getInstanceOrThrow().redirectToUrl(
Expand Down
2 changes: 1 addition & 1 deletion lib/ts/recipe/session/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const getFailureRedirectionInfo = async ({
userContext: any
) => SessionClaimValidator[];
userContext: any;
}): Promise<{ redirectPath?: string | null; failedClaim?: ClaimValidationError }> => {
}): Promise<{ redirectPath?: string; failedClaim?: ClaimValidationError }> => {
const globalValidators = getGlobalClaimValidators({
overrideGlobalClaimValidators,
userContext,
Expand Down
3 changes: 1 addition & 2 deletions lib/ts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,7 @@ export type ThemeBaseProps = {
styleFromInit?: string;
};

// eslint-disable-next-line @typescript-eslint/ban-types
export type FeatureBaseProps<T = {}> = PropsWithChildren<
export type FeatureBaseProps<T = Record<string, unknown>> = PropsWithChildren<
{
navigate?: Navigate;
} & T
Expand Down

0 comments on commit 104a2b0

Please sign in to comment.