fix
This commit is contained in:
@@ -11,7 +11,7 @@ import { revokeConsent } from "@/actions/consents";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
consents: Consent[] | [];
|
consents: Consent[] | null;
|
||||||
setConsents: (consents: Consent[]) => void;
|
setConsents: (consents: Consent[]) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ export default function Applications({ consents, setConsents }: Props) {
|
|||||||
const handleRevoke = async (clientId: string) => {
|
const handleRevoke = async (clientId: string) => {
|
||||||
const result = await revokeConsent(clientId);
|
const result = await revokeConsent(clientId);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
const updated = list.filter(c => c.client_id !== clientId);
|
const updated = list?.filter(c => c.client_id !== clientId) ?? [];
|
||||||
setList(updated);
|
setList(updated);
|
||||||
setConsents(updated);
|
setConsents(updated);
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ export default function Applications({ consents, setConsents }: Props) {
|
|||||||
<h1 className="text-xl">{t("title")}</h1>
|
<h1 className="text-xl">{t("title")}</h1>
|
||||||
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
{list.map((consent) => (
|
{list?.map((consent) => (
|
||||||
<Item key={consent.client_id}>
|
<Item key={consent.client_id}>
|
||||||
<ItemContent>
|
<ItemContent>
|
||||||
<ItemTitle>{consent.client_name}</ItemTitle>
|
<ItemTitle>{consent.client_name}</ItemTitle>
|
||||||
|
|||||||
Reference in New Issue
Block a user