valiot-utility-functions

Utility functions package for Valiot

Usage no npm install needed!

<script type="module">
  import valiotUtilityFunctions from 'https://cdn.skypack.dev/valiot-utility-functions';
</script>

README

Getting Started

Install

Install project dependencies with yarn:

yarn install

Install project pependencies with npm:

npm install

Available Scripts

yarn build

Build only project components for production

yarn start

Start webpack build with watcher.

Updating a new npm version

npm version [major | minor | patch]

Updating npm version.

npm publish

Publish valiot-framework to npm.

Available Functions

Logout

To use the logout function, just import it at the beginning of your file:

import { logout } from 'valiot-utility-functions'

And use it as a normal function. Example:

<button onClick={() => logout()}>Logout</button>

Create Refresh Alert

To use the refreshAlert function, just import it at the beginning of your file:

import { refreshAlert } from 'valiot-utility-functions'

And use it as a normal function passing the link and the cache from the Apollo Client of your application, example:

<button onClick={() => refreshAlert(
  link,
  cache
)}>
  Logout
</button>

Create Alert

To use the createAlert function, just import it at the beginning of your file:

import { createAlert } from 'valiot-utility-functions'

And use it as a normal function passing the link and the cache as the first two parameters. The next parameters will be the following:

  • Title
  • Content
  • Context
  • Link
  • Link text

Example:

<button onClick={() => refreshAlert(
  link,
  cache,
  'Title',
  'Content',
  'INFO',
  'link',
  'linkText'
)}>
  Logout
</button>

Made by Valiot