add logic for fetching posts with ajax in component