How to use the nuxt-property-decorator.namespace function in nuxt-property-decorator

To help you get started, we’ve selected a few nuxt-property-decorator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phamhongphuc / uit.hotel / uit.hotel.client / components / mixins / permission.ts View on Github external
permissionGetService: true,
    permissionManageEmployee: true,
    permissionManageRentingRoom: true,
    permissionManagePatron: true,
    permissionManagePatronKind: true,
    permissionManagePosition: true,
    permissionManagePrice: true,
    permissionManageService: true,
    permissionManageMap: true,
};

export type PermissionUnion = keyof PermissionType;

@Component
export class PermissionMixin extends Vue {
    @(namespace('user').State)
    private employee!: UserLogin.Employee;

    @Prop({
        default: true,
        validator(value: boolean | string[]) {
            if (typeof value === 'boolean') return true;

            if (!Array.isArray(value)) return false;

            return value.every((key: string) => {
                const condition = `permission${key}` in permissionInstance;

                if (!condition) {
                    console.error(
                        `[Permission warn]: String "${key}" is not a is not a valid prop for permission.\n`,
                        `Expect key to be one of these types:`,
github phamhongphuc / uit.hotel / uit.hotel.client / pages / login.vue View on Github external
})
export default class extends Vue {
    id = '';
    password = '';

    layout() {
        return 'side';
    }

    head() {
        return {
            title: 'Đăng nhập',
        };
    }

    @(namespace('user').Action)
    login;
}
github phamhongphuc / uit.hotel / uit.hotel.client / components / layout / navbar.vue View on Github external
import { UserState } from '~/store/user';
import { UserLogin } from '~/graphql/types';

@Component({
    name: 'navbar-',
})
export default class extends Vue {
    isInputFocus = false;

    @(namespace('style').State)
    breakpoint;

    @(namespace('user').Action)
    logout;

    @(namespace('user').State(
        (state: UserState) => state.employee || { position: {} },
    ))
    employee!: UserLogin.Employee;
}

<style lang="scss"></style>
github phamhongphuc / uit.hotel / uit.hotel.client / pages / initialize.vue View on Github external
layout() {
        return 'side';
    }

    head() {
        return {
            title: 'Khởi tạo tài khoản quản trị',
        };
    }

    success() {
        this.$router.push('/');
    }

    @(namespace('user').Action)
    checkIsInitializedDatabase;

    async beforeRouteEnter(to, from, next) {
        next(vm =&gt; vm.checkIsInitializedDatabase());
    }
}