Applying material to a mesh with multiple UV maps

I have a mesh with two materials with corresponding UV maps.

this is the material the model is loaded with heel_quarter_side2 (m-1 with uv-1)

material_1 with UV_1

below is material_2 with UV_2 (ruffy)

Now in three js I want to switch application of the two materials on the model with their corresponding UVs. (m-1 with uv-1 and m-2 with uv-2)

Chatgpt suggests custom shader however i do think there must be a easier solution to it.