aboutsummaryrefslogtreecommitdiff
path: root/apps/browser-extension/utils/query-hooks.ts
diff options
context:
space:
mode:
authorMaheshtheDev <[email protected]>2025-09-24 21:02:05 +0000
committerMaheshtheDev <[email protected]>2025-09-24 21:02:05 +0000
commit7e8b65b36dce243babeefe27ef1739cb4c495beb (patch)
treeab0276e15d84398e92dc9a39071a6ecd0645175f /apps/browser-extension/utils/query-hooks.ts
parentfix(pricing): update the new pricing limits on pro plan (#439) (diff)
downloadarchived-supermemory-7e8b65b36dce243babeefe27ef1739cb4c495beb.tar.xz
archived-supermemory-7e8b65b36dce243babeefe27ef1739cb4c495beb.zip
feat(extension): Auto Logout when token is invalidated, Account Section (#438)
## Changes: - Added token validation logic that checks if the current auth token is still valid - Implemented automatic logout when token is invalidated with appropriate user feedback - Added an Account section in the popup that displays the user's email - Improved error toast messages with clearer formatting and helper text ![image.png](https://app.graphite.dev/user-attachments/assets/b751f6a4-1a33-42d1-88dd-61aff55dd1c7.png)![image.png](https://app.graphite.dev/user-attachments/assets/202f69f9-c853-4801-850e-ee6d115e300c.png)
Diffstat (limited to 'apps/browser-extension/utils/query-hooks.ts')
-rw-r--r--apps/browser-extension/utils/query-hooks.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/browser-extension/utils/query-hooks.ts b/apps/browser-extension/utils/query-hooks.ts
index 721a68ad..5c7cfc21 100644
--- a/apps/browser-extension/utils/query-hooks.ts
+++ b/apps/browser-extension/utils/query-hooks.ts
@@ -5,6 +5,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
import {
fetchProjects,
getDefaultProject,
+ getUserData,
saveMemory,
searchMemories,
setDefaultProject,
@@ -15,6 +16,7 @@ import type { MemoryPayload } from "./types"
export const queryKeys = {
projects: ["projects"] as const,
defaultProject: ["defaultProject"] as const,
+ userData: ["userData"] as const,
}
// Projects Query
@@ -37,6 +39,16 @@ export function useDefaultProject(options?: { enabled?: boolean }) {
})
}
+// User Data Query
+export function useUserData(options?: { enabled?: boolean }) {
+ return useQuery({
+ queryKey: queryKeys.userData,
+ queryFn: getUserData,
+ staleTime: 5 * 60 * 1000, // 5 minutes
+ enabled: options?.enabled ?? true,
+ })
+}
+
// Set Default Project Mutation
export function useSetDefaultProject() {
const queryClient = useQueryClient()