Skip to content

Commit

Permalink
Parse URL and remove amp;
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Jul 1, 2024
1 parent 97831ec commit 45382ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"next-safe-action": "6.2.0",
"next-themes": "^0.3.0",
"nuqs": "^1.17.4",
"query-string": "^9.0.0",
"react": "18.3.1",
"react-colorful": "^5.6.1",
"react-dom": "18.3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
parseAsStringEnum,
useQueryStates,
} from "nuqs";
import queryString from "query-string";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import type z from "zod";
Expand Down Expand Up @@ -68,7 +69,7 @@ export function SelectBankAccountsModal({ countryCode }: Props) {
const [loading, setLoading] = useState(true);
const [eventId, setEventId] = useState<string>();

const [params, setParams] = useQueryStates({
const [_, setParams] = useQueryStates({
step: parseAsStringEnum(["connect", "account", "gocardless"]),
error: parseAsBoolean,
ref: parseAsString,
Expand All @@ -78,6 +79,12 @@ export function SelectBankAccountsModal({ countryCode }: Props) {
provider: parseAsStringEnum(["teller", "plaid", "gocardless"]),
});

// NOTE: GoCardLess sometimes return amp; back in the redirect URL
// Once fixed we can use nuqs and uninstall query-string
const params = queryString.parse(
window.location.search.replaceAll("amp;", "")
);

const { provider, step, error, token, ref, enrollment_id, institution_id } =
params;

Expand Down

0 comments on commit 45382ef

Please sign in to comment.