Skip to content

Commit

Permalink
update frontend types
Browse files Browse the repository at this point in the history
  • Loading branch information
njlie committed Jun 5, 2024
1 parent 0c4deaa commit 2c1adcf
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ export async function action({ request, params }: ActionFunctionArgs) {
idempotencyKey: v4()
})

if (!response?.success) {
if (!response?.id) {
return setMessageAndRedirect({
session,
message: {
content:
response?.message ??
'Could not deposit asset liquidity. Please try again!',
type: 'error'
},
Expand All @@ -79,7 +78,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
return setMessageAndRedirect({
session,
message: {
content: response.message,
content: 'Deposited asset liquidity.',
type: 'success'
},
location: '..'
Expand Down
11 changes: 5 additions & 6 deletions packages/frontend/app/routes/assets.$assetId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ export async function action({ request }: ActionFunctionArgs) {
: { withdrawalThreshold: undefined })
})

if (!response?.success) {
if (!response?.asset) {
actionResponse.errors.general.message = [
response?.message ?? 'Could not update asset. Please try again!'
'Could not update asset. Please try again!'
]
return json({ ...actionResponse }, { status: 400 })
}
Expand All @@ -327,9 +327,8 @@ export async function action({ request }: ActionFunctionArgs) {
}
})

if (!response?.success) {
if (!response?.fee) {
actionResponse.errors.sendingFee.message = [
response?.message ??
'Could not update asset sending fee. Please try again!'
]
return json({ ...actionResponse }, { status: 400 })
Expand All @@ -351,11 +350,11 @@ export async function action({ request }: ActionFunctionArgs) {
}

const response = await deleteAsset({ id: result.data.id })
if (!response?.success) {
if (!response?.asset) {
return setMessageAndRedirect({
session,
message: {
content: response?.message || 'Could not delete Asset.',
content: 'Could not delete Asset.',
type: 'error'
},
location: '.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ export async function action({ request, params }: ActionFunctionArgs) {
timeoutSeconds: BigInt(0)
})

if (!response?.success) {
if (!response?.id) {
return setMessageAndRedirect({
session,
message: {
content:
response?.message ??
'Could not withdraw asset liquidity. Please try again!',
type: 'error'
},
Expand All @@ -80,7 +79,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
return setMessageAndRedirect({
session,
message: {
content: response.message,
content: 'Successfully withdrew asset liquidity.',
type: 'success'
},
location: '..'
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/app/routes/assets.create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ export async function action({ request }: ActionFunctionArgs) {
: { withdrawalThreshold: undefined })
})

if (!response?.success) {
if (!response?.asset) {
errors.message = [
response?.message ?? 'Could not create asset. Please try again!'
'Could not create asset. Please try again!'
]
return json({ errors }, { status: 400 })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ export async function action({ request, params }: ActionFunctionArgs) {
timeoutSeconds: BigInt(0)
})

if (!response?.success) {
if (!response?.id) {
return setMessageAndRedirect({
session,
message: {
content:
response?.message ??
'Could not withdraw incoming payment liquidity. Please try again!',
type: 'error'
},
Expand All @@ -65,7 +64,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
return setMessageAndRedirect({
session,
message: {
content: response.message,
content: 'Withdrew incoming payment liquidity.',
type: 'success'
},
location: '..'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ export async function action({ request, params }: ActionFunctionArgs) {
idempotencyKey: v4()
})

if (!response?.success) {
if (!response?.id) {
return setMessageAndRedirect({
session,
message: {
content:
response?.message ??
'Could not deposit outgoing payment liquidity. Please try again!',
type: 'error'
},
Expand All @@ -66,7 +65,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
return setMessageAndRedirect({
session,
message: {
content: response.message,
content: 'Deposited outgoing payment liquidity.',
type: 'success'
},
location: '..'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,11 @@ export async function action({ request, params }: ActionFunctionArgs) {
timeoutSeconds: BigInt(0)
})

if (!response?.success) {
if (!response?.id) {
return setMessageAndRedirect({
session,
message: {
content:
response?.message ??
'Could not withdraw outgoing payment liquidity. Please try again!',
type: 'error'
},
Expand All @@ -67,7 +66,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
return setMessageAndRedirect({
session,
message: {
content: response.message,
content: 'Withdrew outgoing payment liquidity.',
type: 'success'
},
location: '..'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ export async function action({ request, params }: ActionFunctionArgs) {
idempotencyKey: v4()
})

if (!response?.success) {
if (!response?.id) {
return setMessageAndRedirect({
session,
message: {
content:
response?.message ??
'Could not deposit peer liquidity. Please try again!',
type: 'error'
},
Expand All @@ -79,7 +78,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
return setMessageAndRedirect({
session,
message: {
content: response.message,
content: 'Deposited peer liquidity.',
type: 'success'
},
location: '..'
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/app/routes/peers.$peerId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,9 @@ export async function action({ request }: ActionFunctionArgs) {
: { maxPacketAmount: undefined })
})

if (!response?.success) {
if (!response?.peer) {
actionResponse.errors.general.message = [
response?.message ?? 'Could not update peer. Please try again!'
'Could not update peer. Please try again!'
]
return json({ ...actionResponse }, { status: 400 })
}
Expand Down Expand Up @@ -455,9 +455,9 @@ export async function action({ request }: ActionFunctionArgs) {
}
})

if (!response?.success) {
if (!response?.peer) {
actionResponse.errors.general.message = [
response?.message ?? 'Could not update peer. Please try again!'
'Could not update peer. Please try again!'
]
return json({ ...actionResponse }, { status: 400 })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ export async function action({ request, params }: ActionFunctionArgs) {
timeoutSeconds: BigInt(0)
})

if (!response?.success) {
if (!response?.id) {
return setMessageAndRedirect({
session,
message: {
content:
response?.message ??
'Could not withdraw peer liquidity. Please try again!',
type: 'error'
},
Expand All @@ -80,7 +79,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
return setMessageAndRedirect({
session,
message: {
content: response.message,
content: 'Withdrew peer liquidity',
type: 'success'
},
location: '..'
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/app/routes/peers.create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ export async function action({ request }: ActionFunctionArgs) {
: { maxPacketAmount: undefined })
})

if (!response?.success) {
if (!response?.peer) {
errors.message = [
response?.message ?? 'Could not create peer. Please try again!'
'Could not create peer. Please try again!'
]
return json({ errors }, { status: 400 })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ export async function action({ request, params }: ActionFunctionArgs) {
timeoutSeconds: BigInt(0)
})

if (!response?.success) {
if (!response?.withdrawal) {
return setMessageAndRedirect({
session,
message: {
content:
response?.message ??
'Could not withdraw wallet address liquidity. Please try again!',
type: 'error'
},
Expand All @@ -66,7 +65,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
return setMessageAndRedirect({
session,
message: {
content: response.message,
content: 'Withdrew wallet address liquidity.',
type: 'success'
},
location: '..'
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/app/routes/wallet-addresses.create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ export async function action({ request }: ActionFunctionArgs) {
assetId: result.data.asset
})

if (!response?.success) {
if (!response?.walletAddress) {
errors.message = [
response?.message ?? 'Could not create wallet address. Please try again!'
'Could not create wallet address. Please try again!'
]
return json({ errors }, { status: 400 })
}
Expand Down

0 comments on commit 2c1adcf

Please sign in to comment.