private/apigen: Remove TypeScript errors from generated code
Remove the "duplicate identifier: 'path'" TypeScript errors from the generated code. Change-Id: I6b411a5cee720e2a16353034627954616c480f8a
This commit is contained in:
parent
00484429d6
commit
7ab7ac49c8
@ -23,8 +23,8 @@ export class docsHttpApiV0 {
|
|||||||
const u = new URL(`${this.ROOT_PATH}/${path}`);
|
const u = new URL(`${this.ROOT_PATH}/${path}`);
|
||||||
u.searchParams.set('id', id);
|
u.searchParams.set('id', id);
|
||||||
u.searchParams.set('date', date);
|
u.searchParams.set('date', date);
|
||||||
const path = u.toString();
|
const fullPath = u.toString();
|
||||||
const response = await this.http.post(path, JSON.stringify(request));
|
const response = await this.http.post(fullPath, JSON.stringify(request));
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return response.json().then((body) => body as UpdateContentResponse);
|
return response.json().then((body) => body as UpdateContentResponse);
|
||||||
}
|
}
|
||||||
|
@ -118,15 +118,15 @@ func (f *tsGenFile) createAPIClient(group *EndpointGroup) {
|
|||||||
for _, p := range method.QueryParams {
|
for _, p := range method.QueryParams {
|
||||||
f.pf("\t\tu.searchParams.set('%s', %s);", p.Name, p.Name)
|
f.pf("\t\tu.searchParams.set('%s', %s);", p.Name, p.Name)
|
||||||
}
|
}
|
||||||
f.pf("\t\tconst path = u.toString();")
|
f.pf("\t\tconst fullPath = u.toString();")
|
||||||
} else {
|
} else {
|
||||||
f.pf("\t\tconst path = `%s`;", path)
|
f.pf("\t\tconst fullPath = `%s`;", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
if method.Request != nil {
|
if method.Request != nil {
|
||||||
f.pf("\t\tconst response = await this.http.%s(path, JSON.stringify(request));", strings.ToLower(method.Method))
|
f.pf("\t\tconst response = await this.http.%s(fullPath, JSON.stringify(request));", strings.ToLower(method.Method))
|
||||||
} else {
|
} else {
|
||||||
f.pf("\t\tconst response = await this.http.%s(path);", strings.ToLower(method.Method))
|
f.pf("\t\tconst response = await this.http.%s(fullPath);", strings.ToLower(method.Method))
|
||||||
}
|
}
|
||||||
|
|
||||||
f.pf("\t\tif (response.ok) {")
|
f.pf("\t\tif (response.ok) {")
|
||||||
|
Loading…
Reference in New Issue
Block a user