How to use the reactn.setGlobal function in reactn

To help you get started, we’ve selected a few reactn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Graphite-Docs / graphite / src / components / forms / helpers / singleForm.js View on Github external
currentHostBucket: userSession.loadUserData().username
    }
    const encryptedTeamForm = userSession.encryptContent(JSON.stringify(form), {publicKey: JSON.parse(fetchedKeys).public})

    const teamForm = {
      fileName: `teamForms/${data.teamId}/${singleForm.id}.json`,
      encrypt: false,
      body: JSON.stringify(encryptedTeamForm)
    }
    const postedTeamForm = await postData(teamForm);
    console.log(postedTeamForm);

    singleForm["teamForm"] = true;
    let theseTeams = singleForm.teams;
    singleForm.teams.includes(data.teamId) ? singleForm.teams = theseTeams : singleForm.teams.push(data.teamId);
    await setGlobal({ singleForm });
    if(data.fromSave) {
      //Do nothing
    } else {
      await saveForm(false);
    }

    const privateKey = userSession.loadUserData().appPrivateKey;

    const syncedForm = {
      id: singleForm.id,
      title: userSession.encryptContent(singleForm.title, {publicKey: JSON.parse(fetchedKeys).public}),
      teamName: data.teamName ? userSession.encryptContent(data.teamName, {publicKey: JSON.parse(fetchedKeys).public}) : "",
      orgId: proOrgInfo.orgId,
      teamId: data.teamId,
      lastUpdated: getMonthDayYear(),
      timestamp: Date.now(),
github Graphite-Docs / graphite / src / components / forms / helpers / singleForm.js View on Github external
export async function deleteQuestion(question) {
    let singleForm = getGlobal().singleForm;
    let questions = singleForm.questions;
    let index = await questions.map((x) => {return x.id }).indexOf(question.id);
    if(index > -1) {
        questions.splice(index, 1);
        singleForm["questios"] = questions;
        setGlobal({ singleForm });
        saveForm();
    } else {
        console.log("Error with index");
    }
}
github Graphite-Docs / graphite / src / components / docs / helpers / docsCollectionTags.js View on Github external
export async function deleteTag(tag) {
    let tags = getGlobal().singleDocTags;
    let index = await tags.map((x) => {return x }).indexOf(tag);
    tags.splice(index, 1);
    setGlobal({singleDocTags: tags})
}
github Graphite-Docs / graphite / src / components / files / helpers / vaultTags.js View on Github external
export function addVaultTagManual() {
    let tags = getGlobal().tags;
    setGlobal({ tags: [...tags, getGlobal().tag]}, () => {
    setGlobal({ tag: "" });
    });
}
github Graphite-Docs / graphite / src / components / forms / helpers / formTags.js View on Github external
export function addFormTagManual() {
    let tags = getGlobal().tags;
    setGlobal({ tags: [...tags, getGlobal().tag]}, () => {
    setGlobal({ tag: "" });
    });
}

reactn

React, but with built-in global state management.

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis

Popular reactn functions