generated from pascalmartineau/wp-skeleton
fix: handleSwitchTo
Some checks failed
Deploy WordPress and Nuxt / deploy (push) Failing after 1m49s
Some checks failed
Deploy WordPress and Nuxt / deploy (push) Failing after 1m49s
This commit is contained in:
@@ -32,6 +32,7 @@ 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":
|
||||
|
||||
@@ -26,11 +26,11 @@ export async function handleLogout(event: H3Event) {
|
||||
}
|
||||
|
||||
export async function handleSwitchTo(event: H3Event, data?: SwitchToRootMutation) {
|
||||
if (!data?.userSwitchTo?.user) {
|
||||
if (!data?.switchTo?.user) {
|
||||
return;
|
||||
}
|
||||
const session = await getUserSession(event);
|
||||
const { authToken, refreshToken, user } = data.userSwitchTo;
|
||||
const { authToken, refreshToken, user } = data.switchTo;
|
||||
await setUserSession(event, {
|
||||
user: {
|
||||
id: user.id,
|
||||
|
||||
Reference in New Issue
Block a user