Add beforeFetch and afterFetch event