結果 : javascript wait for api call to finish