Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/dashboard/src/data/workspaces/stop-workspace-mutation.ts
2501 views
1
/**
2
* Copyright (c) 2023 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { useMutation } from "@tanstack/react-query";
8
import { workspaceClient } from "../../service/public-api";
9
10
type StopWorkspaceArgs = {
11
workspaceId: string;
12
};
13
14
export const useStopWorkspaceMutation = () => {
15
// No need to manually update workspace in cache here, we'll receive messages over the ws that will update it
16
return useMutation({
17
mutationFn: async ({ workspaceId }: StopWorkspaceArgs) => {
18
return workspaceClient.stopWorkspace({ workspaceId });
19
},
20
});
21
};
22
23