Merged in fix/sw-3097-negative-point-transfer (pull request #2434)

fix(SW-3097): Improve handling when trying to transfer negative SAS points

* Improve handling of trying to transfer negative points


Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2025-06-26 09:30:02 +00:00
parent bbcabfa0ba
commit 395d466c51
2 changed files with 2 additions and 2 deletions

View File

@@ -248,7 +248,7 @@ async function handleTransferPoints({
cookieStore.delete(SAS_TRANSFER_POINT_KEY)
if (!pointsCookie || !points || isNaN(points)) {
if (!pointsCookie || !points || isNaN(points) || points <= 0) {
return {
url: `/${lang}/sas-x-scandic/error`,
type: "replace",

View File

@@ -53,7 +53,7 @@ export function TransferPointsFormClient({
const calculatedPoints = parsedPoints * (exchangeRate ?? 0)
const handleUpdatePoints = (points: number | null) => {
setPointState(points)
setPointState(points ? Math.min(Math.max(points, 0), sasPoints ?? 0) : null)
}
const hasNoSasPoints = !sasPoints || sasPoints === 0