The sudden shut down – if that is what it is – likely means the battery is dead as well as the connection being intermittent.
Like their counterparts in BEVs – laptop lithium batteries lose capacity if charged (or depleted) fully, continually. Also temperature affects the lifetime while discharging or even if charged well below freezing (obviously the latter is unlikely to be the problem at the moment!).
Look up re Nissan Leaf battery life/capacity, to find how temperature management, or otherwise, affects battery life.
It would appear that the battery back-up period has reduced to zero – likely down to one or more dead cells – and the laptop is actually operating like a mains-fed PC – where turning off the mains would effect an immediate shut-down.
Good luck, but I reckon it may cost rather more than a new or repaired connector, especially if the laptop is old-ish. My tablet actually stops charging when fully charged – whereas older offerings may simply just carry on charging, at that point, which does the battery no good at all as the charge current is simply converted to heat within the battery.
One needs, of course, to be aware that excessive battery charging can lead to conflagration, if cell voltages/temperatures are exceeded excessively – obviously a rare event but you might recall that some mobile phone model(s) were recalled (due to spontaneous combustion) a while back.
Some lithium battery chemistries are better than others in this respect, LIFePO4 being the better choice (but with lower power density).
Edited By not done it yet on 24/08/2020 08:47:53