File "UseCopyMultisiteData.js"
Full path: /home/satkhirabarta/public_html/wp-content/plugins/complianz-gdpr/settings/src/Settings/Multisite/UseCopyMultisiteData.js
File
size: 638 B (638 B bytes)
MIME-type: text/x-java
Charset: utf-8
Download Open Edit Advanced Editor &nnbsp; Back
import {create} from 'zustand';
import * as cmplz_api from "../../utils/api";
const UseCopyMultisiteData = create(( set, get ) => ({
progress:0,
total:0,
start:0,
next:0,
active:false,
copySites: async (restart) => {
let data = {restart:restart};
set({
active:true,
});
const {start, next, total} = await cmplz_api.doAction('copy_multisite', data).then( ( response ) => {
return response});
let progress = Math.round((next/total)*100);
set({
progress:progress,
start:start,
next:next,
total:total,
});
if (progress>=100) {
set({active:false});
}
},
}));
export default UseCopyMultisiteData