0.0.3 • Published 7 months ago

@vanyamate/sec-vue v0.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

SEC Vue

Support for sec

without combine

npm i @vanyamate/sec-vue
// /action/todo/getTodos.action.ts

const getTodosAction = function (userId: string): Array<Todo> {
    return fetch(`/todos`).then((response) => response.json());
};
// /model/todo/todo.model.ts
import { store, effect } from '@vanyamate/sec-vue';


const getTodosEffect = effect(getTodosAction);

export const todoLoading = store(false)
    .on(getTodosEffect, 'onBefore', (state) => {
        state.value = true;
    })
    .on(getTodosEffect, 'onFinally', (state) => {
        state.value = false;
    });
import { useStore } from '@vanyamate/sec-vue';


const loading = useStore(todoLoading);

<template>
    <h2>{{ loading ? 'Загрузка' : '' }}</h2>
</template>;
0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago