import { loadState } from '@nextcloud/initial-state'

const getActiveAppId = () => {
  const apps = loadState('core', 'apps', {})

  for (let id in apps) {
    if (apps[id].active) {
      return id
    }
  }

  return null
}

export { getActiveAppId }
