work on car code

This commit is contained in:
2024-12-18 11:34:21 +03:30
parent 9fccf770d5
commit aedeb62849
7 changed files with 168 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
import { errorResponse } from "@/core/utils/errorResponse";
import { successRequest } from "@/core/utils/successRequest";
import {errorResponse} from "@/core/utils/errorResponse";
import {successRequest} from "@/core/utils/successRequest";
import axios from "axios";
import { useAuth } from "../contexts/auth";
import {useAuth} from "../contexts/auth";
const defaultOptions = {
data: {},
@@ -16,13 +16,12 @@ const defaultOptions = {
};
const useRequest = (initOptions) => {
const { logout } = useAuth();
const {logout} = useAuth();
const _options = Object.assign({}, defaultOptions, initOptions);
return async (url = "", method = "get", options) => {
const mergedOptions = Object.assign({}, _options, options);
try {
const response = await axios({
url,