8.2.4 • Published 1 year ago

brandup-ui-website v8.2.4

Weekly downloads
5
License
Apache-2.0
Repository
github
Last release
1 year ago

brandup-ui-website

Build Status

Installation

Install NPM package brandup-ui-website.

Configure and start

import { host } from "brandup-ui-website";
import { AuthMiddleware } from "./middlewares/auth";
import { CityMiddleware } from "./middlewares/city";
import "./styles.less";

host.start({
    pageTypes: {
        "signin": ()=> import("./pages/signin")
    },
    scripts: {
        "test": () => import("./components/test")
    }
}, (builder) => {
        builder
            .useMiddleware(new AuthMiddleware());
    });

Middleware

Develop custom middleware:

import { Middleware, ApplicationModel, NavigateContext, StartContext, LoadContext, NavigatingContext } from "brandup-ui-app";
import { ajaxRequest } from "brandup-ui";

export class AuthMiddleware extends Middleware<ApplicationModel> {
    start(context: StartContext, next) {
        this.app.registerCommand("signout", () => {
            ajaxRequest({
                url: this.app.uri("api/auth/signout"),
                method: "POST",
                state: null,
                success: () => {
                    this.app.reload();
                }
            });
        });

        console.log(`website id: ${this.app.model.websiteId}`);

        next();
    }

    loaded(context: LoadContext, next) {
        next();
    }

    navigating(context: NavigatingContext, next) {
        next();
    }

    navigate(context: NavigateContext, next) {
        next();
    }
}

Use middleware: builder.useMiddleware(new AuthMiddleware());

Page

import { Page, PageModel } from "brandup-ui-website";

class SignInPage extends Page<PageModel> {
    get typeName(): string { return "SignInPage" }

    onRenderContent() {
        this.registerCommand("test", () => {
            this.submit();
        });

        super.onRenderContent();
    }
}

export default SignInPage;

Export page type require as default.

Register page type:

host.start({
    pageTypes: {
        "signin": ()=> import("./pages/signin")
    }
});
8.2.3

1 year ago

8.0.5

1 year ago

8.2.2

1 year ago

8.0.4

1 year ago

8.0.7

1 year ago

8.2.4

1 year ago

8.1.11

1 year ago

8.1.10

1 year ago

8.1.13

1 year ago

8.1.12

1 year ago

8.1.14

1 year ago

8.1.7

1 year ago

8.1.9

1 year ago

8.1.6

1 year ago

8.1.5

1 year ago

8.2.1

1 year ago

8.0.3

1 year ago

7.1.6

1 year ago

7.1.5

1 year ago

7.1.3

1 year ago

7.1.1

1 year ago

7.1.4

1 year ago

7.0.27

1 year ago

7.0.26

1 year ago

7.0.25

1 year ago

7.0.24

2 years ago

7.0.21

2 years ago

7.0.20

2 years ago

7.0.4

2 years ago

7.0.13

2 years ago

7.0.18

2 years ago

7.0.19

2 years ago

7.0.16

2 years ago

7.0.17

2 years ago

7.0.14

2 years ago

7.0.2

2 years ago

7.0.1

3 years ago

3.1.4

3 years ago

3.1.3

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.0.7

3 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.1

4 years ago

2.1.7

4 years ago

2.1.6

4 years ago

2.1.4

4 years ago

2.1.2

4 years ago

2.1.1

5 years ago

2.0.28

5 years ago

2.0.27

5 years ago

2.0.26

5 years ago

2.0.24

5 years ago

2.0.19

5 years ago

2.0.18

5 years ago

2.0.23

5 years ago

2.0.20

5 years ago

2.0.21

5 years ago

2.0.17

5 years ago

2.0.13

5 years ago

2.0.12

5 years ago

2.0.11

5 years ago

2.0.10

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.1

5 years ago