Twenty-two people are dead and thousands have been left homeless in Niger after torrential rains caused heavy flooding, authorities said.