Fix error when deleting pins

This commit is contained in:
Citlali del Rey 2022-12-17 10:23:05 -08:00
parent db05ae4934
commit b11ca43a08
Signed by: nullobsi
GPG Key ID: 933A1F44222C2634
2 changed files with 5 additions and 2 deletions

View File

@ -126,7 +126,7 @@ sub del_pin($c) {
})->then(sub ($pin) {
if (!defined $pin) {
$c->flash(msg => "That pin doesn't exist.");
return $c->redirect_to('/my/tokens');
return $c->redirect_to('/my');
}
# I wonder if this could cause a race condition.
@ -160,6 +160,9 @@ sub del_pin($c) {
})->then(sub {
$c->flash(msg => "Pin deleted.");
return $c->redirect_to('/my');
}, sub {
$c->flash(msg => "Error: " . $_);
return $c->redirect_to('/my');
});
});
}

View File

@ -36,7 +36,7 @@ sub update($self, $update, $where) {
}
sub cid_count($self, $cid) {
return count({cid => $cid});
return $self->count({cid => $cid});
}
sub count($self, $where) {