typescript-typenfehler behoben.. npm run lint läuft nun fehlerfrei durch.
This commit is contained in:
@@ -5,7 +5,7 @@ interface CheckoutState {
|
||||
currentStep: CheckoutStepId;
|
||||
selectedPackage: CheckoutPackage | null;
|
||||
packageOptions: CheckoutPackage[];
|
||||
authUser: any;
|
||||
authUser: unknown;
|
||||
isAuthenticated: boolean;
|
||||
paymentIntent: string | null;
|
||||
loading: boolean;
|
||||
@@ -19,7 +19,7 @@ interface CheckoutWizardContextType {
|
||||
packageOptions: CheckoutPackage[];
|
||||
currentStep: CheckoutStepId;
|
||||
isAuthenticated: boolean;
|
||||
authUser: any;
|
||||
authUser: unknown;
|
||||
paddleConfig?: {
|
||||
environment?: string | null;
|
||||
client_token?: string | null;
|
||||
@@ -27,7 +27,7 @@ interface CheckoutWizardContextType {
|
||||
paymentCompleted: boolean;
|
||||
selectPackage: (pkg: CheckoutPackage) => void;
|
||||
setSelectedPackage: (pkg: CheckoutPackage) => void;
|
||||
setAuthUser: (user: any) => void;
|
||||
setAuthUser: (user: unknown) => void;
|
||||
nextStep: () => void;
|
||||
prevStep: () => void;
|
||||
previousStep: () => void;
|
||||
@@ -56,7 +56,7 @@ const initialState: CheckoutState = {
|
||||
|
||||
type CheckoutAction =
|
||||
| { type: 'SELECT_PACKAGE'; payload: CheckoutPackage }
|
||||
| { type: 'SET_AUTH_USER'; payload: any }
|
||||
| { type: 'SET_AUTH_USER'; payload: unknown }
|
||||
| { type: 'NEXT_STEP' }
|
||||
| { type: 'PREV_STEP' }
|
||||
| { type: 'GO_TO_STEP'; payload: CheckoutStepId }
|
||||
@@ -72,19 +72,23 @@ function checkoutReducer(state: CheckoutState, action: CheckoutAction): Checkout
|
||||
case 'SET_AUTH_USER':
|
||||
return { ...state, authUser: action.payload, isAuthenticated: Boolean(action.payload) };
|
||||
case 'NEXT_STEP':
|
||||
const steps: CheckoutStepId[] = ['package', 'auth', 'payment', 'confirmation'];
|
||||
const currentIndex = steps.indexOf(state.currentStep);
|
||||
if (currentIndex < steps.length - 1) {
|
||||
return { ...state, currentStep: steps[currentIndex + 1] };
|
||||
{
|
||||
const steps: CheckoutStepId[] = ['package', 'auth', 'payment', 'confirmation'];
|
||||
const currentIndex = steps.indexOf(state.currentStep);
|
||||
if (currentIndex < steps.length - 1) {
|
||||
return { ...state, currentStep: steps[currentIndex + 1] };
|
||||
}
|
||||
return state;
|
||||
}
|
||||
return state;
|
||||
case 'PREV_STEP':
|
||||
const prevSteps: CheckoutStepId[] = ['package', 'auth', 'payment', 'confirmation'];
|
||||
const prevIndex = prevSteps.indexOf(state.currentStep);
|
||||
if (prevIndex > 0) {
|
||||
return { ...state, currentStep: prevSteps[prevIndex - 1] };
|
||||
{
|
||||
const prevSteps: CheckoutStepId[] = ['package', 'auth', 'payment', 'confirmation'];
|
||||
const prevIndex = prevSteps.indexOf(state.currentStep);
|
||||
if (prevIndex > 0) {
|
||||
return { ...state, currentStep: prevSteps[prevIndex - 1] };
|
||||
}
|
||||
return state;
|
||||
}
|
||||
return state;
|
||||
case 'GO_TO_STEP':
|
||||
return { ...state, currentStep: action.payload };
|
||||
case 'UPDATE_PAYMENT_INTENT':
|
||||
@@ -105,7 +109,7 @@ interface CheckoutWizardProviderProps {
|
||||
initialPackage?: CheckoutPackage;
|
||||
packageOptions?: CheckoutPackage[];
|
||||
initialStep?: CheckoutStepId;
|
||||
initialAuthUser?: any;
|
||||
initialAuthUser?: unknown;
|
||||
initialIsAuthenticated?: boolean;
|
||||
paddle?: {
|
||||
environment?: string | null;
|
||||
@@ -173,7 +177,7 @@ export function CheckoutWizardProvider({
|
||||
dispatch({ type: 'SELECT_PACKAGE', payload: pkg });
|
||||
}, []);
|
||||
|
||||
const setAuthUser = useCallback((user: any) => {
|
||||
const setAuthUser = useCallback((user: unknown) => {
|
||||
dispatch({ type: 'SET_AUTH_USER', payload: user });
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user