I have a file with the extension .ts
, which is part of a Ruby on Rails application. The code in this file looks something like this:
export const create = async (params: CreateRequest): Promise<XYZ> => {
const response = await request<XYZ>(`/api/xyz`, 'post', params);
return response?.data;
};
Now, I want to modify it to be like this:
export const create = async (params: CreateRequest): Promise<XYZ> => {
const response = await request<XYZ>(`/api/xyz`, 'post', params, as: :json);
return response?.data;
};
Unfortunately, my attempt to change it didn't work because I'm new to this. Can someone please help me out?