hunk.code_window:     className="file-details__preview"
       href="https://pre-release.mattermost.com/api/v4/files/rqir81f7a7ft8m6j6ej7g1txuo"
       location="file_info_preview"
     >
       <span
         className="file-details__preview-helper"
       />
       <img
  
hunk.labels: keep keep replace keep keep keep keep keep
hunk.file_path: webapp/channels/src/components/file_info_preview/__snapshots__/file_info_preview.test.tsx.snap
hunk.type: replace
file: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
  // See LICENSE.txt for license information.
  
  import type {RequestStatusType} from '@mattermost/types/requests';
  
  import {RequestStatus} from 'mattermost-redux/constants';
  import type {GenericAction} from 'mattermost-redux/types/actions';
  
  export function initialRequestState(): RequestStatusType {
      return {
          status: RequestStatus.NOT_STARTED,
          error: null,
      };
  }
  
  export function handleRequest(
      REQUEST: string,
      SUCCESS: string,
      FAILURE: string,
      state: RequestStatusType,
      action: GenericAction,
  ): RequestStatusType {
      switch (action.type) {
      case REQUEST:
          return {
              ...state,
              status: RequestStatus.STARTED,
          };
      case SUCCESS:
          return {
              ...state,
              status: RequestStatus.SUCCESS,
              error: null,
          };
      case FAILURE: {
          return {
              ...state,
              status: RequestStatus.FAILURE,
              error: action.error,
          };
      }
      default:
          return state;
      }
  }
  