This commit is contained in:
marzban-dev
2025-01-06 19:26:16 +03:30
parent 73d68810be
commit cdc0ebec26
13 changed files with 536 additions and 0 deletions
@@ -0,0 +1,33 @@
// imports
import { useMutation } from "@tanstack/vue-query";
import axios from "~/configs/axios.config";
import { API_ENDPOINTS } from "~/constants";
// types
export type CreateBranchRequest = {
name: string;
description: string;
};
// methods
export const handleCreateBranch = async ({ name, description }: CreateBranchRequest) => {
const payload: CreateBranchRequest = {
name,
description,
};
await axios.post<CreateBranchRequest>(API_ENDPOINTS.branch.createBranch, payload);
};
// composable
const useCreateBranch = () => {
return useMutation({
mutationFn: (data: CreateBranchRequest) => handleCreateBranch(data),
});
};
export default useCreateBranch;