Providing the initial app state excluding any lazily loaded module state

We want to start by defining the initial app state, excluding any lazily loaded feature module state. Since our CoreModule provides AuthService, which deals with handling our user, we will consider the user slice a fundamental key to our app's initial state.

In particular, let's begin by defining the shape of our user state. Create app/modules/core/states/user.state.ts:

export interface IUserState {  recentUsername?: string;  current?: any;  loginCanceled?: boolean;}export const userInitialState: IUserState = {};

Our user state is very simple. It contains a recentUsername representing a string of the most recently successfully authenticated username (useful if the user ...

Get NativeScript for Angular Mobile Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.