generated from pascalmartineau/wp-skeleton
fix: defineGraphqlServerOptions
This commit is contained in:
@@ -11,7 +11,9 @@ async function refreshAuthToken(refreshToken: string): Promise<string | null> {
|
||||
return refreshResponse.data?.refreshJwtAuthToken?.authToken || null;
|
||||
}
|
||||
|
||||
export default defineGraphqlServerOptions({
|
||||
// The `object` generic is needed to prevent TS 2322
|
||||
// @see https://github.com/dulnan/nuxt-graphql-middleware/issues/69
|
||||
export default defineGraphqlServerOptions<object>({
|
||||
async serverFetchOptions(event) {
|
||||
const headers = {
|
||||
Cookie: getRequestHeader(event, "cookie") || "",
|
||||
@@ -31,8 +33,6 @@ export default defineGraphqlServerOptions({
|
||||
|
||||
return { headers: { ...headers, Authorization: `Bearer ${session.secure.authToken}` } };
|
||||
},
|
||||
|
||||
// @ts-expect-error https://github.com/dulnan/nuxt-graphql-middleware/issues/69
|
||||
async onServerResponse(event, response, _operation, operationName) {
|
||||
switch (operationName) {
|
||||
case "login":
|
||||
|
||||
Reference in New Issue
Block a user