import { AuthUser } from './VueAuthOptions' ; import { IVueAuthOptions } from '../lib/auth' ; interface IVueAuthStore { getUser ( ) : AuthUser ; setUser ( user ) : void ; getToken ( ) : string ; setToken ( token ) : void ; getRoles ( ) : string [ ] ; } export abstract class VueAuthStore implements IVueAuthStore { protected store : any ; protected constructor ( protected Vue , protected options ) { } public abstract getUser ( ) ; public abstract setUser ( user ) ; public abstract getToken ( ) ; public abstract setToken ( token ) ; public abstract getRoles ( ) ; protected initVue ( ) { const token = this . getToken ( ) ; if ( token ) { this . options . Vue . $data . token = token ; } const user = this . getUser ( ) ; if ( user ) { this . options . Vue . $data . user = user ; } } }