Dashboard-Plugin
Docs HomeDashboard plugins and appsInfomakerNaviga global
  • About
  • Intro
  • Getting started
  • The anatomy of a plugin
  • Manifest structure
  • Getting started
    • Get Dashboard-Plugin
    • Build
  • What's new
  • Components
    • Agent
      • Actions
    • Application
    • Widget
    • Health
    • Modal
    • Settings
  • API and GUI
    • API
      • Overview
      • register
        • Reducers
        • Portals
        • Requirements
        • Permissions
        • Default config
        • Config Modifiers
      • cache
      • store
      • encrypt
      • decrypt
      • createUUID
      • getLanguage
      • getTextDirection
      • getTimeFormat
      • getKeyCharFromCode
      • getKeyCodeFromChar
      • event
      • Logger
      • buildRouteUrlWithDispatchableEvent
      • getUser
      • getAction
      • getPortal
      • getConfig
      • getLocalize
      • getAvailableActions
      • getAvailablePortals
      • request
      • setHealth
      • openModal
      • closeModal
      • confirm
      • notifications
      • hasPermission
      • standalone
      • withUser
      • useModal
      • useSheet
      • useUser
      • useConfig
      • useLocalize
      • useApplication
      • useMappings
      • useStandalone
    • GUI
      • Core GUI
      • Style-Guide
    • Modules
      • GUI
      • Utility
      • NavigaID
        • getUserToken
        • getApplicationToken
        • getGroupsFromToken
  • Mappings
  • Plugins deployments
  • S3 upload
  • Deprecations
    • 4.1.0
    • 4.0.0
    • 2.1.0
Powered by GitBook
On this page
  • How to use
  • Store payload
  • Save data to store
  • Get data from store
  • Remove data from store

Was this helpful?

  1. API and GUI
  2. API

store

handle storing data persistently store "DynamoDB"

How to use

import { Plugin } from '@root'

Plugin.store({
    ...STORE_PAYLOAD
})

Store payload

Param

Typeof

Default

Required

Description

key

String

null

✅

the cache key to be used to save/get/remove your data from store.

data

Any

null

✅

the data item to be stored.

callback

Function

null

❌

a callback will be called when the data is saved/removed from store

method

String

GET

❌

a method to save/get/remove available methods: GET, POST, DELETE

personal

Boolean

false

❌

if true Dashboard will append the user sub to the key automatically

Save data to store

import { Plugin } from '@root'

const item = {
    id: 'item-id',
    name: 'item name'
}

const onSave = () => {

}

Plugin.store({
    key: 'my-store-key',
    data: item,
    method: 'POST',
    callback: onSave
})

Get data from store

import { Plugin } from '@root'

const onGet = storedData => {
    console.log(storedData)
    /*
        Output:
        {
            id: 'item-id',
            name: 'item name'
        }
    */
}

Plugin.store({
    key: 'my-store-key',
    method: 'GET', // can be ignored, as GET is the default method for cache
    callback: onGet
})

Remove data from store

import { Plugin } from '@root'

Plugin.store({
    key: 'my-store-key',
    method: 'DELETE'
})
PreviouscacheNextencrypt

Last updated 4 years ago

Was this helpful?