A Vue.js project


5.0.24 years ago4 years agoMinified + gzip package size for @mycure/auth in KB



Mycure Vue Auth module

Installation and Usage

$ yarn add @mycure/auth
  • use as a vue plugin
import Vue from 'vue';
import McAuth from '@mycure/auth';

Vue.use(McAuth, opts: ServiceOpts)
  • above will do the ff:
    • describe side effects here
    • sample side effects:
      • attach a global method/attribute
      • attach an instance method/attribute
      • add components
      • sync a single and multi vuex store modules
  interface FailHandlerParams {
    user: User
    authService: AuthService
    next: (route) => void // available only in router, can be used to navigate as this will only proxy router.push

  interface VerifierConfig {
    cache: boolean // if the last value of the verifier should be cached
    match: any | (val: any) => boolean // if fxn, matcher function to be used to determine if pass. else will be ==='d to the value
    onFail: (error: Error, params: FailHandlerParams) => boolean

  interface Verifier {
    onAuthKey: string // key to use in checklist
    routeGuardKey: string // key to use in router
    failMessage: String // for logging
    verifier: (verifierConfig: boolean | string | VerifierConfig, user: User, authService: AuthService, sessionStore: SessionStore) => Promise<{
      formattedKey?: string, // mainly for logging
      value: any,            // current value of the verifier
      failHandler: Function, // to be executed when failed (from verifierConfig)
      passed: boolean        // flag if verifier has passed

  interface RouterOpts = {
    logoutURL?: string,
    authURL: string = '/login'
    verifiers: Verifier [] = ServiceOpts.verifiers

  interface StoreOpts {
    moduleName: string = 'auth'

  interface ServiceOpts {
    // will be used to auto-generate query functions
    firebaseApp?: firebase.App
    URL_ACCOUNTS: string = '/v3/accounts'
    URL_EMR_ACCESS: string = '/v3/access/emr/data'
    URL_CMS_ACCESS: string = '/v3/access/clinic-management'
    URL_ACCOUNT_ACCESS: string = '/v3/access/my-account'
    URL_SECRETARY_ACCESS: string = '/v3/access/secretary'
    verifiers: Verifier []
    // for registering router guards
    router: VueRouter
    routerOpts?: RouterOpts
    // for registering built-in store modules
    store: VuexStore
    storeOpts?: StoreOpts
    // and other valid SingleItemSyncService and MultiItemSyncService configs, see @topsi/services docus



vuexModuleName = 'auth'
interface RegeisteredVuexModuleActions {
  signInWithEmailAndPassword: (email: string, password: string) => void
  signInWithCustomToken: (token: string) => void  
  // and the extraActions

interface RegisteredVuexModule extends RegisteredAuthStoreModule { 
  // see @topsi/services docus for its RegisteredAuthStoreModule
  actions: RegeisteredVuexModuleActions

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.