Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CU-86dt27bzj - Create a WcSdk method to wipe all requests from a dapp #114

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

melanke
Copy link
Contributor

@melanke melanke commented Apr 17, 2024

adding a toast to prevent breaking the app when wiping the requests

… -> adding a toast to prevent breaking the app when wiping the requests
@melanke
Copy link
Contributor Author

melanke commented Apr 17, 2024

@@ -2,6 +2,9 @@ import React, { useState } from 'react'
import { TypeChecker } from '@cityofzion/neon-dappkit-types'
import { NetworkType, useWalletConnect, SignMessageVersion } from '@cityofzion/wallet-connect-sdk-react'
import { dappMethods, networks } from '../Constants'
import 'toastify-js/src/toastify.css'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider importing CSS in a central file or at the root level of your application. This will help to keep all style imports in one place and improve code organization.

@@ -2,6 +2,9 @@ import React, { useState } from 'react'
import { TypeChecker } from '@cityofzion/neon-dappkit-types'
import { NetworkType, useWalletConnect, SignMessageVersion } from '@cityofzion/wallet-connect-sdk-react'
import { dappMethods, networks } from '../Constants'
import 'toastify-js/src/toastify.css'
// @ts-ignore
import Toastify from 'toastify-js'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using @ts-ignore as it suppresses all typescript errors in the next line. If there's a specific error you want to ignore, use @ts-expect-error instead and provide a comment explaining why the error is being ignored.

signers: [{ scopes: 1 }],
})

console.log(resp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using console.log for debugging in production code.

signers: [{ scopes: 1 }],
})

console.log(resp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using window.alert for debugging in production code.

],
signers: [{ scopes: 1 }],
})
console.log(resp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using console.log for debugging in production code.

console.log(resp)
window.alert(JSON.stringify(resp, null, 2))
} catch (e) {
onError(e)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider providing a more descriptive error message in the onError function to help with debugging.

@@ -336,46 +390,60 @@ function HelloWorld() {
console.log(resp2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using console.log for debugging in production code. It's better to use a logging library that can be toggled for development/production.

},
],
})
console.log(resp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using console.log for debugging in production code. It's better to use a logging library that can be toggled for development/production.

setResponse(JSON.stringify(resp, null, 2))
try {
const resp = await wcSdk.wipeRequests()
console.log(resp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using console.log for debugging in production code. It's better to use a logging library that can be toggled for development/production.

}
}

const onError = (error: any) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding types to your function parameters for better type safety. Instead of any, use a specific type or create an interface for the error object.

@LeonardoDizConde LeonardoDizConde merged commit 5fa094e into main Apr 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants