Skip to content

Instantly share code, notes, and snippets.

View sohseyedi-web's full-sized avatar
😎

sohseyedi sohseyedi-web

😎
View GitHub Profile
@sohseyedi-web
sohseyedi-web / custom-axios.js
Last active February 27, 2025 17:58
Axios Interceptor (RefreshToken - AccessToken)
import axios from "axios";
const BASE_URL = process.env.API_URL;
const app = axios.create({
baseURL: BASE_URL,
withCredentials: true,
});
app.interceptors.request.use(
//types
import type { Ref } from "vue";
import type { z, ZodTypeAny } from "zod";
export type ZodFormType<T extends ZodTypeAny> = z.infer<T>;
export interface ValidateFormType<T extends ZodTypeAny> {
values: ZodFormType<T>;
schema: T;
errors: Ref<Record<string, string>>;