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

chore: remove lint warnings #1272

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions account-kit/rn-signer/example/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require("path");
const { getDefaultConfig } = require("@react-native/metro-config");

const rnSignerRoot = path.resolve(__dirname, "..");
const projectRoot = __dirname;
// handles the hoisted modules
Expand Down
54 changes: 30 additions & 24 deletions account-kit/rn-signer/example/src/screens/magic-link-auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,42 @@ export default function MagicLinkAuthScreen() {
const [email, setEmail] = useState<string>("");
const [user, setUser] = useState<User | null>(null);

const handleUserAuth = ({ bundle }: { bundle: string }) => {
signer
.authenticate({
bundle,
type: "email",
})
.then(setUser)
.catch(console.error);
};
const handleUserAuth = useCallback(
linnall marked this conversation as resolved.
Show resolved Hide resolved
({ bundle }: { bundle: string }) => {
signer
.authenticate({
bundle,
type: "email",
})
.then(setUser)
.catch(console.error);
},
[]
);

const handleIncomingURL = useCallback((event: { url: string }) => {
const regex = /[?&]([^=#]+)=([^&#]*)/g;
const handleIncomingURL = useCallback(
(event: { url: string }) => {
const regex = /[?&]([^=#]+)=([^&#]*)/g;

let params: Record<string, string> = {};
let match: RegExpExecArray | null;
let params: Record<string, string> = {};
let match: RegExpExecArray | null;

while ((match = regex.exec(event.url))) {
if (match[1] && match[2]) {
params[match[1]] = match[2];
while ((match = regex.exec(event.url))) {
if (match[1] && match[2]) {
params[match[1]] = match[2];
}
}
}

if (!params.bundle || !params.orgId) {
return;
}
if (!params.bundle || !params.orgId) {
return;
}

handleUserAuth({
bundle: params.bundle ?? "",
});
}, []);
handleUserAuth({
bundle: params.bundle ?? "",
});
},
[handleUserAuth]
);

useEffect(() => {
// get the user if already logged in
Expand Down
Loading