From 6ca2655b2d866bd15c02a992be1ab2f89a4605e1 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 15 Sep 2025 22:52:49 +0200 Subject: [PATCH] refacotr: using `undefined` instead of `null` in all places --- src/app/login/login.component.ts | 2 +- src/app/store/login.actions.ts | 2 +- src/app/store/login.reducers.ts | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index bbaf374..9c4f8a5 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -18,7 +18,7 @@ export class LoginComponent { private store = inject(Store); form: FormGroup; - error: string|null = null; + error: string|undefined = undefined; isLoading : boolean = false; constructor(private fb: FormBuilder) { diff --git a/src/app/store/login.actions.ts b/src/app/store/login.actions.ts index ba6e195..1319408 100644 --- a/src/app/store/login.actions.ts +++ b/src/app/store/login.actions.ts @@ -2,7 +2,7 @@ import { createAction, props } from '@ngrx/store'; export const login = createAction( '[Login] User Login', - props<{ username: string|null, password: string|null }>() + props<{ username: string|undefined, password: string|undefined }>() ); export const loginSuccess = createAction( diff --git a/src/app/store/login.reducers.ts b/src/app/store/login.reducers.ts index 951624a..98ce5fc 100644 --- a/src/app/store/login.reducers.ts +++ b/src/app/store/login.reducers.ts @@ -2,19 +2,19 @@ import { createReducer, on } from '@ngrx/store'; import { login, loginFailure, loginSuccess } from './login.actions'; export interface State { - token: string|null; - error: string|null; + token: string|undefined; + error: string|undefined; isLoading: boolean; } const initialState: State = { - token: null, - error: null, + token: undefined, + error: undefined, isLoading: false }; export const loginReducers = createReducer(initialState, on(login, state => ({ ...state, isLoading: true })), - on(loginSuccess, (state, { token }) => ({ ...state, token, error: null, isLoading: false })), - on(loginFailure, (state, { error }) => ({ ...state, token: null, error, isLoading: false })) + on(loginSuccess, (state, { token }) => ({ ...state, token, error: undefined, isLoading: false })), + on(loginFailure, (state, { error }) => ({ ...state, token: undefined, error, isLoading: false })) ); -- 2.39.5