Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
copyLink = () => {
/* Get the text field */
var copyText = document.getElementById("copyLink");
/* Select the text field */
copyText.select();
/* Copy the text inside the text field */
document.execCommand("copy");
ToastsStore.success(`Link copied`)
}
copyLink = () => {
/* Get the text field */
var copyText = document.getElementById("copyLink");
/* Select the text field */
copyText.select();
/* Copy the text inside the text field */
document.execCommand("copy");
ToastsStore.success(`Link copied`)
}
.then(async (res) => {
console.log(res.data)
if(res.data.success === false) {
ToastsStore.error(res.data.message);
} else {
await loadData();
ToastsStore.success(`File removed`);
}
}).catch((error) => {
console.log(error);
.then((res) => {
if(res.data.success === true) {
handleProCheck();
setGlobal({ orgNameModalOpen: false });
ToastsStore.success("Account name updated!");
} else {
ToastsStore.error(res.data.message);
}
}).catch(err => console.log(err))
}
.then(async (res) => {
console.log(res.data)
if(res.data.success === false) {
ToastsStore.error(res.data.message);
} else {
await loadData();
ToastsStore.success(`Document removed`);
}
}).catch((error) => {
console.log(error);
export async function saveTags() {
setGlobal({tagModalOpen: false})
ToastsStore.success(`Saving tags...`)
let file = getGlobal().singleFile;
file["tags"] = getGlobal().tags;
//Save the single file first
try {
let singleFileParams = {
fileName: `${file.id}.json`,
body: JSON.stringify(file),
encrypt: true
}
let postedFile = await postData(singleFileParams)
console.log(postedFile)
} catch(error) {
console.log(error)
}
//Then update the file collection and save it
let files = await getGlobal().files;
export async function saveTags() {
setGlobal({tagModalOpen: false})
ToastsStore.success(`Saving tags...`)
let form = getGlobal().singleForm;
form["tags"] = getGlobal().tags;
//Save the single file first
try {
let singleFormParams = {
fileName: `forms/${form.id}.json`,
body: JSON.stringify(form),
encrypt: true
}
let postedForm = await postData(singleFormParams)
console.log(postedForm)
} catch(error) {
console.log(error)
}
//Then update the forms collection and save it
let forms = await getGlobal().forms;
export async function saveTags() {
setGlobal({tagModalOpen: false})
ToastsStore.success(`Saving tags...`)
let singleDoc = getGlobal().singleDoc;
singleDoc["singleDocTags"] = getGlobal().singleDocTags;
//Save the single Doc first
try {
let file = `/documents/${singleDoc.id}.json`
let singleDocParams = {
fileName: file,
body: JSON.stringify(singleDoc),
encrypt: true
}
let updatedSingleDoc = await postData(singleDocParams)
console.log(updatedSingleDoc)
} catch(error) {
console.log(error)
}
//Then update the doc collection and save it
export async function loadForm(id, refresh) {
let fetchedKeys;
const { userSession } = getGlobal();
let teamForm = window.location.href.includes('team') ? true : false;
if(refresh === false) {
setGlobal({ formLoading: false });
ToastsStore.success(`Fetching new responses...`);
} else {
setGlobal({ formLoading: true });
}
if(teamForm) {
const teamId = window.location.href.split('team/')[1].split('/')[0];
//Need to load the team form info first, then we can figure out which bucket to load from.
//Fetch teamKeys
const teamKeyParams = {
fileName: `user/${userSession.loadUserData().username.split('.').join('_')}/team/${teamId}/key.json`,
decrypt: true,
}
fetchedKeys = await fetchData(teamKeyParams);
setGlobal({ teamKeys: fetchedKeys });
const data = {
profile: userSession.loadUserData().profile,
fileName: 'forms.json',
encrypt: true,
body: JSON.stringify(getGlobal().forms)
}
const newIndex = await postData(newFormIndex);
console.log(newIndex);
ToastsStore.success(`Form saved`);
} else {
console.log("Error form index");
ToastsStore.error(`Trouble saving form`);
}
}
const newForm = await postData(newFormParams);
ToastsStore.success(`Form saved`);
console.log(newForm);
}