Is this problem happening only when you're connecting to one particular WiFi network or is does this happen when you're connecting to any WiFi network?
If the former, it's probably something to do with just that one network. Try rebooting both your phone and the router and see if that fixes the problem. Otherwise, please provide more details on the router model and the general set up on that network. Is it your home network or a work one?
If the latter, that indicates it could be a problem with your phone. Is your Mi A1 running Nougat or Pie?