Skip to content

enviroment.ts example

lorenzoli edited this page Mar 9, 2022 · 4 revisions
export const environment: Environment = {
    production: false,
    name: 'Admin Console',
    logo: true,
    assets: {
        logo: '',
        imageError: ''
    },
    currentLang: 'it',
    domains: false,
    api: {
        baseUrl: 'http://localhost:3000/api/',
        setupEndpoint: 'setup'
    },
    auth: {
        credentials: {
            'username': 'username',
            'password': 'password'
        },
        tokenKey: 'access_token',
        refreshToken: {
            endpoint: 'users/refresh-token'
        },
        login: {
            endpoint: 'users/login',
            form: {
                title: 'Login',
                class: 'col-sm-12 primary',
                fields: {
                    base: [
                        {
                            key: 'email',
                            type: 'text',
                            label: 'Email',
                            placeholder: 'Email',
                            validators: {
                                required: true
                            }
                        },
                        {
                            key: 'password',
                            type: 'password',
                            label: 'Password',
                            placeholder: 'Password',
                            validators: {
                                required: true
                            }
                        }
                    ],
                },
                submit: {
                    label: 'Login'
                },
                buttons: [
                    {
                        class: 'btn-sm btn-link no-padding',
                        content: 'Password dimenticata ?',
                        config: {
                            path: '/password-reset'
                        }
                    }
                ],
                isLoginForm: true
            }
        },
        passwordReset: {
            endpoint: '/reset-password',
            form: {
                class: 'col-sm-12 primary',
                title: 'Password reset',
                fields: {
                    base: [
                        {
                            key: 'username',
                            type: 'text',
                            label: 'Email',
                            placeholder: 'Email',
                            validators: {
                                required: true
                            }
                        }
                    ],
                },
                submit: {
                    label: 'Resetta password'
                },
                buttons: [
                    {
                        class: 'btn-sm btn-link no-padding',
                        content: 'Torna al login',
                        config: {
                            path: '/login'
                        }
                    }
                ]
            }
        },
        passwordChange: {
            endpoint: '/change-password',
            form: {
                class: 'col-sm-12 primary',
                title: 'Change password',
                fields: {
                    base: [
                        {
                            key: 'newPassword',
                            type: 'password',
                            label: 'New password',
                            placeholder: 'New password',
                            validators: {
                                required: true
                            }
                        }
                    ]
                },
                submit: {
                    label: 'Update'
                }
            }
        }
    }
};

NB: NgxBackend default route for change password is /password-change?ACCESS_TOKEN_KEY={token}. This route is enabled only if passwordChange on environment is setted. Passing query string param ACCESS_TOKEN_KEY name is get by env on auth.tokenKey.

Clone this wiki locally