Filter in Frappe Call as Optional

My case is when user A logs in the filter condition in frappe call works but if user B logs in, the filter kindof hides like it doesn’t exist. In short, i am trying to use filter as a terninary operator. Any suggestion for doing so or I need to write 2 frappe-calls for each user A & B.

Thank you

tried this

var zxc = (user_role=="HR" ? "filters: { 'role':"+user+"}":"filters: {}")
console.log(zxc)

  frappe.call({
    method:"frappe.client.get_list",
    args: {
      doctype:"RSet",
      fields: ['act'],
      zxc,
    },
    async:false,
    callback:function(r){
      console.log(r.message
    }
});

But it is giving all the values. Any help ??

solved. was doing silly mistake

var zxc = (user_role=="HR" ? '{"role":"'+user+'"}':'{}')

and in frappe call intead of zxc, i used

filters: zxc,