import { clearUserState } from '@/store/user/action' ; import store from '@/store' ; import { Cookie } from '@/utils/cache' ; import rootConfig from '@root/src/shared/config' ; import { history } from '@/router' ; export const signOut = ( ) => { Cookie . remove ( rootConfig . adminTokenKey ) ; store . dispatch ( clearUserState ( ) ) ; history . push ( '/login' ) ; } ; export const getBase64ByFile = ( file ) : Promise < string > => { return new Promise ( ( resolve , reject ) => { const reader = new FileReader ( ) ; reader . readAsDataURL ( file ) ; reader . onload = ( ) => resolve ( reader . result as string ) ; reader . onerror = ( error ) => reject ( error ) ; } ) ; } ;