Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
/ admin-helpers Public archive

DOM utils for E-Com Plus admin and related frontend apps

License

Notifications You must be signed in to change notification settings

ecomplus/admin-helpers

Repository files navigation

E-Com Plus Admin Helpers

Publish CodeFactor npm version License AGPL

DOM utils for E-Com Plus admin and related frontend apps

CHANGELOG

Usage

npm i @ecomplus/admin-helpers

Example

import { i19savedWithSuccess } from '@ecomplus/i18n'
import { i18n } from '@ecomplus/utils'
import ecomAuth from '@ecomplus/auth'
import { toast, handleApiError } from '@ecomplus/admin-helpers'

ecomAuth.login(localStorage.getItem('username'), localStorage.getItem('password'))

ecomAuth.on('login', () => {
  ecomAuth.requestApi('stores/me', 'patch', {
    domain: 'www.mystoredomain.com'
  })
    .then(() => toast(i18n(i19savedWithSuccess)))
    .catch(handleApiError)
})

CDN

<script src="https://cdn.jsdelivr.net/npm/@ecomplus/admin-helpers/dist/toast.var.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@ecomplus/admin-helpers/dist/handle-api-error.var.min.js"></script>
window.toast('Hello!')

External dependencies

It uses jQuery and Bootstrap 4 scripts (toast only).