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

Commit9bf0cd7

Browse files
committed
More refactoring
1 parentd545ba5 commit9bf0cd7

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

‎src/api/coderApi.ts‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,36 +110,42 @@ export class CoderApi extends Api {
110110
logs:ProvisionerJobLog[],
111111
options?:ClientOptions,
112112
)=>{
113-
constsearchParams=newURLSearchParams({follow:"true"});
114-
constlastLog=logs.at(-1);
115-
if(lastLog){
116-
searchParams.append("after",lastLog.id.toString());
117-
}
118-
119-
returnthis.createWebSocket<ProvisionerJobLog>({
120-
apiRoute:`/api/v2/workspacebuilds/${buildId}/logs`,
121-
searchParams,
113+
returnthis.watchLogs<ProvisionerJobLog>(
114+
`/api/v2/workspacebuilds/${buildId}/logs`,
115+
logs,
122116
options,
123-
});
117+
);
124118
};
125119

126120
watchWorkspaceAgentLogs=async(
127121
agentId:string,
128122
logs:WorkspaceAgentLog[],
129123
options?:ClientOptions,
130124
)=>{
125+
returnthis.watchLogs<WorkspaceAgentLog[]>(
126+
`/api/v2/workspaceagents/${agentId}/logs`,
127+
logs,
128+
options,
129+
);
130+
};
131+
132+
privateasyncwatchLogs<TData>(
133+
apiRoute:string,
134+
logs:{id:number}[],
135+
options?:ClientOptions,
136+
){
131137
constsearchParams=newURLSearchParams({follow:"true"});
132138
constlastLog=logs.at(-1);
133139
if(lastLog){
134140
searchParams.append("after",lastLog.id.toString());
135141
}
136142

137-
returnthis.createWebSocket<WorkspaceAgentLog[]>({
138-
apiRoute:`/api/v2/workspaceagents/${agentId}/logs`,
143+
returnthis.createWebSocket<TData>({
144+
apiRoute,
139145
searchParams,
140146
options,
141147
});
142-
};
148+
}
143149

144150
privateasynccreateWebSocket<TData=unknown>(
145151
configs:Omit<OneWayWebSocketInit,"location">,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp