Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
For search using API I am sending the input to the backend using string interpolation in react

I am sending like "oemName": %${''}% which works fine but without % it doesnt work which is making me wonder why its happening.

const getEquipmentNameSearch = async (SearchText?: any) => {
    console.log("Args", SearchText)

    try {
        const responseData: any = await client.query({
            query: SEARCH_EQUIPMENTS_BY_NAME,
            variables: {
                "oemName": SearchText === undefined ? `%${''}%` : `%${SearchText}%`,
                // "oemName": `${''}`
            },
            fetchPolicy: 'network-only',
            context: { role: MasterMaterialRoles.read },
        });
        const filteredResult = responseData.data.equipmentMaster?.filter((item: any) => item.oemName.toLowerCase().includes(SearchText?.toLowerCase()))
        const responseDataList = SearchText ? filteredResult : responseData.data.equipmentMaster
        dispatch({
            type: GET_EQUIPMENT_MASTER,
            payload: responseDataList,
        });

    } catch (error: any) {
        console.log('err:', error)

    }
}

On directly using ${''} I am getting '' in payload but nothing is getting rendered on the page.

Payload

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!