refactor: centralize API endpoints and token refresh logic

This commit is contained in:
Your Name
2026-04-11 14:15:27 +05:30
parent 54d2021e81
commit dfd33f1dad
6 changed files with 83 additions and 32 deletions
+3 -2
View File
@@ -5,9 +5,10 @@ import { useState } from "react";
import { useForm } from "react-hook-form";
import { useNavigate } from "react-router-dom";
import { z } from "zod";
import authApiClient from "../api/apiClient";
import { preAuthApiClient } from "../api/apiClient";
import Logo from "../components/Logo";
import FormField from "../components/ui/FormField";
import { endpoints } from "../config/endpoints";
// validation logic
const registerSchema = z
@@ -41,7 +42,7 @@ export default function Register() {
setIsLoading(true);
setApiError(null);
try {
await authApiClient.post("/register/", {
await preAuthApiClient.post(endpoints.REGISTER, {
full_name: data.full_name,
email: data.email,
password: data.password,