feat: Replace eslint => oxlint + oxfmt
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import type { H3Event } from "h3";
|
||||
import { jwtDecode } from "jwt-decode";
|
||||
import type { User } from "#auth-utils";
|
||||
import type { AuthUserFragment, AuthLoginMutationResult } from "#graphql/operations";
|
||||
import { AuthRefreshTokenDocument } from "#graphql/operations";
|
||||
import type { ResultOf } from "#graphql/registry";
|
||||
import type { H3Event } from "h3";
|
||||
import { jwtDecode } from "jwt-decode";
|
||||
|
||||
// Handle login result and store user session
|
||||
export async function handleLogin(event: H3Event, loginResult: AuthLoginMutationResult) {
|
||||
@@ -54,10 +54,13 @@ export async function refreshAuthToken(refreshToken: string): Promise<string | u
|
||||
const refreshPromise = (async () => {
|
||||
const { wpUrl } = useRuntimeConfig();
|
||||
const endpoint = `${wpUrl}/graphql`;
|
||||
const { data } = await executeGraphQLHTTP<ResultOf<"AuthRefreshToken">>({
|
||||
query: AuthRefreshTokenDocument,
|
||||
variables: { refreshToken },
|
||||
}, { endpoint });
|
||||
const { data } = await executeGraphQLHTTP<ResultOf<"AuthRefreshToken">>(
|
||||
{
|
||||
query: AuthRefreshTokenDocument,
|
||||
variables: { refreshToken },
|
||||
},
|
||||
{ endpoint }
|
||||
);
|
||||
return data?.refreshToken?.authToken || undefined;
|
||||
})();
|
||||
|
||||
@@ -91,8 +94,7 @@ export async function getAuthToken(event: H3Event): Promise<string | undefined>
|
||||
}
|
||||
session.secure.authToken = newAuthToken;
|
||||
await setUserSession(event, session);
|
||||
}
|
||||
catch {
|
||||
} catch {
|
||||
await clearUserSession(event);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user