mirror of https://github.com/coder/coder.git
33 lines
908 B
TypeScript
33 lines
908 B
TypeScript
import {
|
|
deleteWorkspaceAgentSharedPort,
|
|
getWorkspaceAgentSharedPorts,
|
|
upsertWorkspaceAgentSharedPort,
|
|
} from "api/api";
|
|
import type {
|
|
DeleteWorkspaceAgentPortShareRequest,
|
|
UpsertWorkspaceAgentPortShareRequest,
|
|
} from "api/typesGenerated";
|
|
|
|
export const workspacePortShares = (workspaceId: string) => {
|
|
return {
|
|
queryKey: ["sharedPorts", workspaceId],
|
|
queryFn: () => getWorkspaceAgentSharedPorts(workspaceId),
|
|
};
|
|
};
|
|
|
|
export const upsertWorkspacePortShare = (workspaceId: string) => {
|
|
return {
|
|
mutationFn: async (options: UpsertWorkspaceAgentPortShareRequest) => {
|
|
await upsertWorkspaceAgentSharedPort(workspaceId, options);
|
|
},
|
|
};
|
|
};
|
|
|
|
export const deleteWorkspacePortShare = (workspaceId: string) => {
|
|
return {
|
|
mutationFn: async (options: DeleteWorkspaceAgentPortShareRequest) => {
|
|
await deleteWorkspaceAgentSharedPort(workspaceId, options);
|
|
},
|
|
};
|
|
};
|