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:
@@ -248,7 +248,7 @@ async function handleTransferPoints({
|
|||||||
|
|
||||||
cookieStore.delete(SAS_TRANSFER_POINT_KEY)
|
cookieStore.delete(SAS_TRANSFER_POINT_KEY)
|
||||||
|
|
||||||
if (!pointsCookie || !points || isNaN(points)) {
|
if (!pointsCookie || !points || isNaN(points) || points <= 0) {
|
||||||
return {
|
return {
|
||||||
url: `/${lang}/sas-x-scandic/error`,
|
url: `/${lang}/sas-x-scandic/error`,
|
||||||
type: "replace",
|
type: "replace",
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export function TransferPointsFormClient({
|
|||||||
const calculatedPoints = parsedPoints * (exchangeRate ?? 0)
|
const calculatedPoints = parsedPoints * (exchangeRate ?? 0)
|
||||||
|
|
||||||
const handleUpdatePoints = (points: number | null) => {
|
const handleUpdatePoints = (points: number | null) => {
|
||||||
setPointState(points)
|
setPointState(points ? Math.min(Math.max(points, 0), sasPoints ?? 0) : null)
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasNoSasPoints = !sasPoints || sasPoints === 0
|
const hasNoSasPoints = !sasPoints || sasPoints === 0
|
||||||
|
|||||||
Reference in New Issue
Block a user