File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- VITE_API_URL = http://localhost:5312
1+ VITE_API_URL = http://localhost:3000
2+ VITE_AUTH_MODE = server
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import Profile from "./pages/Profile";
2222
2323export default function App ( ) {
2424 return (
25- < AuthProvider apiHost = { API_URL } mode = "web " >
25+ < AuthProvider apiHost = { API_URL } mode = "server " >
2626 < Routes >
2727 < Route path = "/unauthenticated" element = { < Unauthenticated /> } />
2828
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export function useRevokeSession() {
1313
1414 return useMutation ( {
1515 mutationFn : ( id : string ) =>
16- apiFetch ( `/sessions/${ id } ` , {
16+ apiFetch ( `/admin/ sessions/${ id } ` , {
1717 method : "DELETE" ,
1818 } ) ,
1919 onSuccess : ( ) => {
Original file line number Diff line number Diff line change 44 * See LICENSE file in the project root for full license information
55 */
66
7- import { getApiUrl } from "./runtimeConfig" ;
7+ import { getApiUrl , getAuthMode } from "./runtimeConfig" ;
88
99export const API_URL = getApiUrl ( ) ;
1010
@@ -16,7 +16,9 @@ export async function apiFetch<T>(
1616
1717 headers . set ( "Content-Type" , "application/json" ) ;
1818
19- const res = await fetch ( `${ API_URL } ${ path } ` , {
19+ const adapater = getAuthMode ( ) === "server" ? "auth" : "" ;
20+
21+ const res = await fetch ( `${ API_URL } ${ adapater } ${ path } ` , {
2022 credentials : "include" ,
2123 ...options ,
2224 headers,
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ declare global {
88 interface Window {
99 __SEAMLESS_CONFIG__ ?: {
1010 API_URL : string ;
11+ AUTH_MODE : string ;
1112 } ;
1213 }
1314}
@@ -19,3 +20,11 @@ export function getApiUrl(): string {
1920
2021 return import . meta. env . VITE_API_URL ;
2122}
23+
24+ export function getAuthMode ( ) : string {
25+ if ( window . __SEAMLESS_CONFIG__ ?. AUTH_MODE ) {
26+ return window . __SEAMLESS_CONFIG__ . AUTH_MODE ;
27+ }
28+
29+ return import . meta. env . VITE_AUTH_MODE ;
30+ }
You can’t perform that action at this time.
0 commit comments