shelflife-react-hooks 1.0.3 → 1.0.4
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/package.json
CHANGED
|
@@ -28,7 +28,7 @@ type UserContextValue = {
|
|
|
28
28
|
fetchUser: (id: number) => Promise<User | null>;
|
|
29
29
|
updateUser: (id: number, dto: ChangeUserDataRequest) => Promise<User>;
|
|
30
30
|
deleteUser: (id: number) => Promise<void>;
|
|
31
|
-
getUserPfp: (id: number) => Promise<
|
|
31
|
+
getUserPfp: (id: number) => Promise<Blob>;
|
|
32
32
|
uploadUserPfp: (id: number, file: Blob) => Promise<void>;
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -121,7 +121,7 @@ export const deleteUserRequest = async (
|
|
|
121
121
|
export const getUserPfpRequest = async (
|
|
122
122
|
config: UserApiConfig,
|
|
123
123
|
id: number
|
|
124
|
-
): Promise<
|
|
124
|
+
): Promise<Blob> => runWithRequestState(config, async () => {
|
|
125
125
|
const normalizedBaseUrl = normalizeBaseUrl(config.baseUrl);
|
|
126
126
|
const response = await fetch(`${normalizedBaseUrl}/api/users/${id}/pfp`, {
|
|
127
127
|
headers: buildAuthHeaders(config.token)
|
|
@@ -131,7 +131,7 @@ export const getUserPfpRequest = async (
|
|
|
131
131
|
throw new Error('Failed to fetch user pfp');
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
return
|
|
134
|
+
return response.blob();
|
|
135
135
|
});
|
|
136
136
|
|
|
137
137
|
export const uploadUserPfpRequest = async (
|