add loading state for api requests