@ecomplus/admin-helpers
v1.2.4
Published
DOM utils for E-Com Plus admin and related frontend apps
Downloads
3
Readme
E-Com Plus Admin Helpers
DOM utils for E-Com Plus admin and related frontend apps
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).