Don't you want the opposite ? If online, endpoint is the API, otherwise the local db ?