Skip to content

Commit

Permalink
fixed types
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Jan de Wit <[email protected]>
  • Loading branch information
edewit committed Sep 17, 2024
1 parent f0cddfe commit 761f682
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions js/apps/account-ui/src/account-security/LinkedAccounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ export const LinkedAccounts = () => {
LinkedAccountRepresentation[]
>([]);

const [paramsUnlinked, setParamsUnlinked] = useState<Record<string, any>>({
const [paramsUnlinked, setParamsUnlinked] = useState<Record<string, string>>({
first: "0",
max: "6",
linked: false,
linked: "false",
});
const [paramsLinked, setParamsLinked] = useState<Record<string, any>>({
const [paramsLinked, setParamsLinked] = useState<Record<string, string>>({
first: "0",
max: "6",
linked: true,
linked: "true",
});
const [key, setKey] = useState(1);
const refresh = () => setKey(key + 1);
Expand Down Expand Up @@ -57,23 +57,21 @@ export const LinkedAccounts = () => {
</Title>
<LinkedAccountsToolbar
onFilter={(search) =>
setParamsLinked({ ...paramsLinked, first: 0, search })
setParamsLinked({ ...paramsLinked, first: "0", search })
}
count={linkedAccounts.length}
first={parseInt(paramsLinked["first"])}
max={parseInt(paramsLinked["max"])}
onNextClick={() => {
setParamsLinked({
...paramsLinked,
first:
parseInt(paramsLinked.first) + parseInt(paramsLinked.max) - 1,
first: `${parseInt(paramsLinked.first) + parseInt(paramsLinked.max) - 1}`,
});
}}
onPreviousClick={() =>
setParamsLinked({
...paramsLinked,
first:
parseInt(paramsLinked.first) - parseInt(paramsLinked.max) + 1,
first: `${parseInt(paramsLinked.first) - parseInt(paramsLinked.max) + 1}`,
})
}
onPerPageSelect={(first, max) =>
Expand All @@ -83,13 +81,13 @@ export const LinkedAccounts = () => {
max: `${max}`,
})
}
hasNext={linkedAccounts.length > paramsLinked.max - 1}
hasNext={linkedAccounts.length > parseInt(paramsLinked.max) - 1}
/>
<DataList id="linked-idps" aria-label={t("linkedLoginProviders")}>
{linkedAccounts.length > 0 ? (
linkedAccounts.map(
(account, index) =>
index !== paramsLinked.max - 1 && (
index !== parseInt(paramsLinked.max) - 1 && (
<AccountRow
key={account.providerName}
account={account}
Expand All @@ -113,27 +111,29 @@ export const LinkedAccounts = () => {
</Title>
<LinkedAccountsToolbar
onFilter={(search) =>
setParamsUnlinked({ ...paramsUnlinked, first: 0, search })
setParamsUnlinked({ ...paramsUnlinked, first: "0", search })
}
count={unlinkedAccounts.length}
first={parseInt(paramsUnlinked["first"])}
max={parseInt(paramsUnlinked["max"])}
onNextClick={() => {
setParamsUnlinked({
...paramsUnlinked,
first:
first: `${
parseInt(paramsUnlinked.first) +
parseInt(paramsUnlinked.max) -
1,
1
}`,
});
}}
onPreviousClick={() =>
setParamsUnlinked({
...paramsUnlinked,
first:
first: `${
parseInt(paramsUnlinked.first) -
parseInt(paramsUnlinked.max) +
1,
1
}`,
})
}
onPerPageSelect={(first, max) =>
Expand All @@ -143,13 +143,13 @@ export const LinkedAccounts = () => {
max: `${max}`,
})
}
hasNext={unlinkedAccounts.length > paramsUnlinked.max - 1}
hasNext={unlinkedAccounts.length > parseInt(paramsUnlinked.max) - 1}
/>
<DataList id="unlinked-idps" aria-label={t("unlinkedLoginProviders")}>
{unlinkedAccounts.length > 0 ? (
unlinkedAccounts.map(
(account, index) =>
index !== paramsUnlinked.max - 1 && (
index !== parseInt(paramsUnlinked.max) - 1 && (
<AccountRow
key={account.providerName}
account={account}
Expand Down
2 changes: 1 addition & 1 deletion js/apps/account-ui/src/api/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export async function getCredentials({ signal, context }: CallOptions) {

export async function getLinkedAccounts(
{ signal, context }: CallOptions,
requestParams: Record<string, any>,
requestParams: Record<string, string>,
) {
const response = await request("/linked-accounts", context, {
searchParams: requestParams,
Expand Down

0 comments on commit 761f682

Please sign in to comment.