Encoder gives values only in one way

In the first code, you only trigger the interrupt handler when the A pin changes.
In the second code, you only trigger the interrupt handlers when the A and B pins fall.

You need to trigger both handlers when the corresponding pin CHANGES.