@oxyhq/auth 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/cjs/.tsbuildinfo +1 -0
- package/dist/cjs/hooks/mutations/useAccountMutations.js +5 -4
- package/dist/cjs/hooks/queryClient.js +2 -2
- package/dist/cjs/hooks/useFileDownloadUrl.js +27 -14
- package/dist/cjs/stores/accountStore.js +8 -38
- package/dist/cjs/utils/avatarUtils.js +0 -25
- package/dist/esm/.tsbuildinfo +1 -0
- package/dist/esm/hooks/mutations/useAccountMutations.js +5 -4
- package/dist/esm/hooks/queryClient.js +2 -2
- package/dist/esm/hooks/useFileDownloadUrl.js +27 -14
- package/dist/esm/stores/accountStore.js +2 -32
- package/dist/esm/utils/avatarUtils.js +0 -24
- package/dist/types/.tsbuildinfo +1 -0
- package/dist/types/hooks/mutations/useAccountMutations.d.ts +1 -6
- package/dist/types/hooks/useFileDownloadUrl.d.ts +6 -3
- package/dist/types/stores/accountStore.d.ts +2 -9
- package/dist/types/utils/avatarUtils.d.ts +0 -10
- package/package.json +4 -4
- package/src/hooks/mutations/useAccountMutations.ts +8 -7
- package/src/hooks/queryClient.ts +2 -2
- package/src/hooks/useFileDownloadUrl.ts +33 -24
- package/src/stores/accountStore.ts +15 -47
- package/src/utils/avatarUtils.ts +1 -31
package/src/utils/avatarUtils.ts
CHANGED
|
@@ -5,38 +5,9 @@ import { useAuthStore } from '../stores/authStore';
|
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
6
|
import { queryKeys, invalidateUserQueries, invalidateAccountQueries } from '../hooks/queries/queryKeys';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Updates file visibility to public for avatar use.
|
|
10
|
-
* Handles errors gracefully, only logging non-404 errors.
|
|
11
|
-
*
|
|
12
|
-
* @param fileId - The file ID to update visibility for
|
|
13
|
-
* @param oxyServices - OxyServices instance
|
|
14
|
-
* @param contextName - Optional context name for logging
|
|
15
|
-
* @returns Promise that resolves when visibility is updated (or skipped)
|
|
16
|
-
*/
|
|
17
|
-
export async function updateAvatarVisibility(
|
|
18
|
-
fileId: string | undefined,
|
|
19
|
-
oxyServices: OxyServices,
|
|
20
|
-
contextName: string = 'AvatarUtils'
|
|
21
|
-
): Promise<void> {
|
|
22
|
-
// Skip if temporary asset ID or no file ID
|
|
23
|
-
if (!fileId || fileId.startsWith('temp-')) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
await oxyServices.assetUpdateVisibility(fileId, 'public');
|
|
29
|
-
// Visibility update is logged by the API
|
|
30
|
-
} catch (visError: any) {
|
|
31
|
-
// Silently handle errors - 404 means asset doesn't exist yet (which is OK)
|
|
32
|
-
// Other errors are logged by the API, so no need to log here
|
|
33
|
-
// Function continues gracefully regardless of visibility update success
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
8
|
/**
|
|
38
9
|
* Refreshes avatar in accountStore with cache-busted URL to force image reload.
|
|
39
|
-
*
|
|
10
|
+
*
|
|
40
11
|
* @param sessionId - The session ID for the account to update
|
|
41
12
|
* @param avatarFileId - The new avatar file ID
|
|
42
13
|
* @param oxyServices - OxyServices instance to generate download URL
|
|
@@ -99,4 +70,3 @@ export async function updateProfileWithAvatar(
|
|
|
99
70
|
|
|
100
71
|
return data;
|
|
101
72
|
}
|
|
102
|
-
|