PHP Classes

File: resources/js/Stores/activities.js

Recommend this page to a friend!
  Classes of Nyi Nyi Lwin   S3 B2B PHP Amazon S3 File Manager   resources/js/Stores/activities.js   Download  
File: resources/js/Stores/activities.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: S3 B2B PHP Amazon S3 File Manager
Manage files stored in multiple Amazon S3 buckets
Author: By
Last change:
Date: 9 months ago
Size: 991 bytes
 

Contents

Class file image Download
import { defineStore } from 'pinia'; export const useActivitiesStore = defineStore('activities', { state: () => ({ activities: [], }), getters: { movingActivities: state => { return state.activities.filter(activity => activity.type === 'moving' && activity.status === 'pending'); }, }, actions: { findActivityIndex(activity) { return this.activities.findIndex(item => { const { type, fileName } = item; return ( type === activity.type && fileName === activity.fileName ); }); }, addActivity(activity) { const exist = this.findActivityIndex(activity); if (exist === -1) { this.activities.push(activity); } }, markActivityAsCompleted(activity) { const index = this.findActivityIndex(activity); if (index !== -1) { this.activities[index].status = 'completed'; } }, clearActivities() { this.activities = []; }, }, });