integrate backend Google OAuth and set up avatar media proxy
- Implement the full login and onboarding workflow to handle name, handle, and avatar. - Rewrite avatar asset URLs to route through the self-hosted media service. - Add Next.js rewrites configuration to proxy media requests directly to the FastAPI backend.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { HttpLink } from "@apollo/client";
|
||||
import {
|
||||
ApolloClient,
|
||||
ApolloNextAppProvider,
|
||||
InMemoryCache,
|
||||
} from "@apollo/experimental-nextjs-app-support";
|
||||
|
||||
// 创建一个初始化 Client 的函数
|
||||
function makeClient() {
|
||||
const httpLink = new HttpLink({
|
||||
uri: process.env.NEXT_PUBLIC_GRAPHQL_URL || "http://localhost:8000/graphql",
|
||||
// 确保跨域请求自动带上 Cookie
|
||||
credentials: "include",
|
||||
});
|
||||
|
||||
return new ApolloClient({
|
||||
cache: new InMemoryCache(),
|
||||
link: httpLink,
|
||||
});
|
||||
}
|
||||
|
||||
// 导出我们的包装组件
|
||||
export function GraphqlProvider({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<ApolloNextAppProvider makeClient={makeClient}>
|
||||
{children}
|
||||
</ApolloNextAppProvider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { GraphqlProvider } from "./ApolloProvider";
|
||||
|
||||
export function Providers({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<GraphqlProvider>
|
||||
{/* 在这里可以继续嵌套其他全局 Provider */}
|
||||
{children}
|
||||
</GraphqlProvider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user