refactor: integrate Better-Auth for authentication and remove Supabase dependencies
This commit is contained in:
@@ -29,7 +29,7 @@ import type {
|
||||
UserProfileResponse,
|
||||
} from '@repo/api-contract';
|
||||
import axios, { AxiosError } from 'axios';
|
||||
import { createAuthClient } from "better-auth/react";
|
||||
import { createAuthClient } from 'better-auth/react';
|
||||
|
||||
const apiBaseUrl =
|
||||
import.meta.env.VITE_API_BASE_URL?.trim() ||
|
||||
@@ -37,9 +37,11 @@ const apiBaseUrl =
|
||||
|
||||
export const authClient = createAuthClient({
|
||||
baseURL: apiBaseUrl,
|
||||
fetchOptions: {
|
||||
credentials: 'include',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
export class ApiClientError extends Error {
|
||||
status?: number;
|
||||
details?: unknown;
|
||||
@@ -66,6 +68,7 @@ const handlers: ErrorHandlers = {};
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: apiBaseUrl,
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
@@ -285,6 +288,6 @@ export function configureApiClient(nextHandlers: ErrorHandlers) {
|
||||
handlers.onError = nextHandlers.onError;
|
||||
}
|
||||
|
||||
export function setApiAccessToken(token: string | null) {
|
||||
export function setApiAccessToken(_token: string | null) {
|
||||
// accessToken = token;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user