feat: Initial authentication logic and UX
This commit is contained in:
19
wp-content/themes/moonshine/shared/types/auth.d.ts
vendored
Normal file
19
wp-content/themes/moonshine/shared/types/auth.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// auth.d.ts
|
||||
declare module "#auth-utils" {
|
||||
interface User {
|
||||
id: number;
|
||||
email: string;
|
||||
roles: string[];
|
||||
}
|
||||
|
||||
interface UserSession {
|
||||
loggedInAt: string;
|
||||
}
|
||||
|
||||
interface SecureSessionData {
|
||||
authToken: string;
|
||||
refreshToken: string;
|
||||
}
|
||||
}
|
||||
|
||||
export { };
|
||||
3
wp-content/themes/moonshine/shared/utils/delay.ts
Normal file
3
wp-content/themes/moonshine/shared/utils/delay.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export async function delay(ms: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
4
wp-content/themes/moonshine/shared/utils/graphql.ts
Normal file
4
wp-content/themes/moonshine/shared/utils/graphql.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// Helper: Extracts nodes from a GraphQL connection object, returning an empty array if nodes are absent.
|
||||
export function extractNodes<T>(connection: { nodes?: T[] } | null | undefined): T[] {
|
||||
return connection?.nodes || [] as T[];
|
||||
}
|
||||
Reference in New Issue
Block a user