How to view pdf response from post request in react

Viewed 1073

I'm getting a pdf file from an API in response to a post request

code

export const getParkingReciept = (bookindId) => {
    return async function (dispatch, getState) {
        try {

            const TOKEN = getState().Auth.token;
            const formdata = new FormData();
            formdata.append("booking_id", bookindId);

            var config = {
                method: 'post',
                url: `${BASE_URL}parking-space/booking/receipt`,
                headers: {
                             'Accept': 'application/json',
                             'Authorization': `Bearer ${TOKEN}`,
                             'Content-Type': 'multipart/form-data'
                         },
                        data: formdata
            };

            const response = await axios(config)
            console.log("responseParkingReciept", response)


        } catch (e) {
            
        }
    }
}

Eventhough I get a response with content type:"Application/pdf" I don't see any link or blob in response enter image description here

But I do get an Image when I try from postman. enter image description here What am I missing ? I dont see any link or blob in response

0 Answers
Related