mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
chore(connector): update the parse of email usage api response (#4201)
This commit is contained in:
parent
088efeef1a
commit
474cc4c2c6
1 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
import { assert } from '@silverhand/essentials';
|
||||
import { HTTPError, got } from 'got';
|
||||
import { z } from 'zod';
|
||||
|
||||
import type {
|
||||
CreateConnector,
|
||||
|
@ -13,6 +14,7 @@ import {
|
|||
validateConfig,
|
||||
ConnectorError,
|
||||
ConnectorErrorCodes,
|
||||
parseJson,
|
||||
} from '@logto/connector-kit';
|
||||
|
||||
import { defaultMetadata, defaultTimeout, emailEndpoint, usageEndpoint } from './constant.js';
|
||||
|
@ -101,7 +103,7 @@ const getUsage =
|
|||
},
|
||||
});
|
||||
|
||||
return Number(httpResponse.body);
|
||||
return z.object({ count: z.number() }).parse(parseJson(httpResponse.body)).count;
|
||||
};
|
||||
|
||||
const createLogtoEmailConnector: CreateConnector<EmailConnector> = async ({ getConfig }) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue