How do i pause an app until an API process has finished.