import { ApiTokenTypes , READ_ONLY , READ_WRITE , SEARCH_DISPLAY , WRITE_ONLY } from '../constants' ; import { ApiToken } from '../types' ; export const getModeDisplayText = ( apiToken ) : string => { const { read = false , write = false , type } = apiToken ; switch ( type ) { case ApiTokenTypes . Admin : return '--' ; case ApiTokenTypes . Search : return SEARCH_DISPLAY ; default : if ( read && write ) { return READ_WRITE ; } return write ? WRITE_ONLY : READ_ONLY ; } } ;