mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
refactor(console): get real time email service usage (#4258)
This commit is contained in:
parent
8a0725938c
commit
2e4cd0b817
3 changed files with 4 additions and 6 deletions
|
@ -116,7 +116,7 @@ function ConnectorContent({ isDeleted, connectorData, onConnectorUpdated }: Prop
|
||||||
if (connectorData.usage === undefined) {
|
if (connectorData.usage === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
onConnectorUpdated({ ...connectorData, usage: connectorData.usage + 1 });
|
onConnectorUpdated();
|
||||||
}, [connectorData, onConnectorUpdated]);
|
}, [connectorData, onConnectorUpdated]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -16,6 +16,7 @@ import * as styles from './index.module.scss';
|
||||||
type Props = {
|
type Props = {
|
||||||
usage: number;
|
usage: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
function EmailUsage({ usage }: Props) {
|
function EmailUsage({ usage }: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||||
|
|
|
@ -51,12 +51,9 @@ function ConnectorDetails() {
|
||||||
const [isReadMeOpen, setIsReadMeOpen] = useState(false);
|
const [isReadMeOpen, setIsReadMeOpen] = useState(false);
|
||||||
const [isSetupOpen, setIsSetupOpen] = useState(false);
|
const [isSetupOpen, setIsSetupOpen] = useState(false);
|
||||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||||
/**
|
|
||||||
* TODO: Can add `keepPreviousData` option to useSWR to avoid the flash on `Skeleton`
|
|
||||||
* component when manually trigger `mutate` function. This change is available in `swr@v2.0` or above.
|
|
||||||
*/
|
|
||||||
const { data, error, mutate } = useSWR<ConnectorResponse, RequestError>(
|
const { data, error, mutate } = useSWR<ConnectorResponse, RequestError>(
|
||||||
connectorId && `api/connectors/${connectorId}`
|
connectorId && `api/connectors/${connectorId}`,
|
||||||
|
{ keepPreviousData: true }
|
||||||
);
|
);
|
||||||
const {
|
const {
|
||||||
data: connectorFactory,
|
data: connectorFactory,
|
||||||
|
|
Loading…
Reference in a new issue