Sha256: 2088556709f73168e1316437616f7e9cb097742d6161fefaccd4c4e5609b73fb

Contents?: true

Size: 1.87 KB

Versions: 5

Compression:

Stored size: 1.87 KB

Contents

/*
Copyright (c) 2022, all rights reserved.
All the information provided by this platform is protected by international laws related  to 
industrial property, intellectual property, copyright and relative international laws. 
All intellectual or industrial property rights of the code, texts, trade mark, design, 
pictures and any other information belongs to the owner of this platform.
Without the written permission of the owner, any replication, modification,
transmission, publication is strictly forbidden.
For more information read the license file including with this software.
// · ~·~     ~·~     ~·~     ~·~     ~·~     ~·~     ~·~     ~·~     ~·~     ~·~     ~·~     ~·~
// · 
*/


// · 
import { defineStore } from "pinia"


// · 
export const useUsersRegistrations = defineStore("userRegistrations", {
    state: () => {
        return {
            loading: false,
            pagination: {}, 
            records: [],
            periods : []
        }
    },
    actions: {

        fetchIfEmpty() {
            if (this.records.length <= 0) {
                this.fetch('month')
            }
        },

        getOptions(){
            this.loading = true
            this.http.get(this.url.audit("users/options")).then(result => {
                this.periods = result.periods
            }).catch(error => {
                this.msg.danger("Error while trying to fetch data")
            }).finally(() => {
                this.loading = false
            })

        },

        fetch(period) {
            this.loading = true
                this.http.get(this.url.audit("users/registrations").group(period)).then(result => {
                this.records = result.reverse()
            }).catch(error => {
                this.msg.danger("Error while trying to fetch data")
            }).finally(() => {
                this.loading = false
            })
        }

    }
})

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lesli_audit-0.5.0 lib/vue/stores/users/registrations.js
lesli_audit-0.4.0 lib/vue/stores/users/registrations.js
lesli_audit-0.3.0 lib/vue/stores/users/registrations.js
lesli_audit-0.2.0 lib/vue/stores/users/registrations.js
lesli_audit-0.1.0 lib/vue/stores/users/registrations.js