Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e51776

Browse files
committed
🧹
1 parent6348fd2 commit5e51776

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

‎site/src/api/api.ts

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,17 @@ const BASE_CONTENT_TYPE_JSON = {
300300
"Content-Type":"application/json",
301301
}asconstsatisfiesHeadersInit;
302302

303-
exporttypeGetTemplateOptions=Readonly<{
303+
exporttypeGetTemplatesOptions=Readonly<{
304304
readonlydeprecated?:boolean;
305305
}>;
306306

307+
functionnormalizeGetTemplatesOptions(
308+
options:GetTemplatesOptions={},
309+
):Record<string,string>{
310+
const{ deprecated=false}=options;
311+
return{deprecated:String(deprecated)};
312+
}
313+
307314
typeSearchParamOptions=TypesGen.Pagination&{
308315
q?:string;
309316
};
@@ -626,16 +633,9 @@ class ApiMethods {
626633
};
627634

628635
getTemplates=async(
629-
options?:GetTemplateOptions,
636+
options?:GetTemplatesOptions,
630637
):Promise<TypesGen.Template[]>=>{
631-
constparams:Record<string,string>={};
632-
if(options?.deprecated!==undefined){
633-
// Just want to check if it isn't undefined. If it has
634-
// a boolean value, convert it to a string and include
635-
// it as a param.
636-
params["deprecated"]=String(options.deprecated);
637-
}
638-
638+
constparams=normalizeGetTemplatesOptions(options);
639639
constresponse=awaitthis.axios.get<TypesGen.Template[]>(
640640
`/api/v2/templates`,
641641
{ params},
@@ -649,16 +649,9 @@ class ApiMethods {
649649
*/
650650
getTemplatesByOrganization=async(
651651
organization:string,
652-
options?:GetTemplateOptions,
652+
options?:GetTemplatesOptions,
653653
):Promise<TypesGen.Template[]>=>{
654-
constparams:Record<string,string>={};
655-
if(options?.deprecated!==undefined){
656-
// Just want to check if it isn't undefined. If it has
657-
// a boolean value, convert it to a string and include
658-
// it as a param.
659-
params["deprecated"]=String(options.deprecated);
660-
}
661-
654+
constparams=normalizeGetTemplatesOptions(options);
662655
constresponse=awaitthis.axios.get<TypesGen.Template[]>(
663656
`/api/v2/organizations/${organization}/templates`,
664657
{ params},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp