import store from '@/store/index'

//跳转登录
export const toLogin = () => {
  sessionStorage.clear();
  window.location.replace("/login");
}

export const has = (value: any) => {
  const permissions = store.state.app.permissions;
  let hasPermissions = null
  if (value && value instanceof Array && value.length > 0) {
    hasPermissions = permissions.some((p: string) => value.includes(p));
  } else {
    hasPermissions = permissions.includes(value)
  }
  if (hasPermissions) {
    return true
  }
  return false
}
