Added call to api and condition if api returns ok