Added Get Profile Pictures hook
This commit is contained in:
parent
6dd85db35d
commit
d2d7aaaf79
3 changed files with 24 additions and 0 deletions
|
|
@ -31,6 +31,8 @@ export const INVALID_SELECTION_ERROR_ALERT = "Invalid selection";
|
||||||
export const EDIT_PASSWORD_ERROR_ALERT = "Error changing password";
|
export const EDIT_PASSWORD_ERROR_ALERT = "Error changing password";
|
||||||
export const EDIT_PASSWORD_ALERT_LIST = "Passwords do not match";
|
export const EDIT_PASSWORD_ALERT_LIST = "Passwords do not match";
|
||||||
export const SAVE_ERROR_ALERT = "Error saving changes";
|
export const SAVE_ERROR_ALERT = "Error saving changes";
|
||||||
|
export const PROFILE_PICTURES_GET_ERROR_ALERT =
|
||||||
|
"Error retrieving profile pictures";
|
||||||
export const SIGNUP_ERROR_ALERT = "Error signing up";
|
export const SIGNUP_ERROR_ALERT = "Error signing up";
|
||||||
export const APIKEY_ERROR_ALERT = "API Key Error";
|
export const APIKEY_ERROR_ALERT = "API Key Error";
|
||||||
export const NOAPI_ERROR_ALERT =
|
export const NOAPI_ERROR_ALERT =
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { PROFILE_PICTURES_GET_ERROR_ALERT } from "../../../../../../../../../constants/alerts_constants";
|
||||||
|
|
||||||
|
const useGetProfilePictures = (setErrorData) => {
|
||||||
|
const handleGetProfilePictures = async () => {
|
||||||
|
try {
|
||||||
|
} catch (error) {
|
||||||
|
setErrorData({
|
||||||
|
title: PROFILE_PICTURES_GET_ERROR_ALERT,
|
||||||
|
list: [(error as any)?.response?.data?.detail],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return handleGetProfilePictures;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useGetProfilePictures;
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
|
import useAlertStore from "../../../../../../../../stores/alertStore";
|
||||||
import { gradients } from "../../../../../../../../utils/styleUtils";
|
import { gradients } from "../../../../../../../../utils/styleUtils";
|
||||||
|
import useGetProfilePictures from "./hooks/use-get-profile-pictures";
|
||||||
|
|
||||||
export default function ProfilePictureChooserComponent({ value, onChange }) {
|
export default function ProfilePictureChooserComponent({ value, onChange }) {
|
||||||
|
const setErrorData = useAlertStore((state) => state.setErrorData);
|
||||||
|
const getProfilePictures = useGetProfilePictures({ setErrorData });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-wrap items-center justify-start gap-2">
|
<div className="flex flex-wrap items-center justify-start gap-2">
|
||||||
{gradients.map((gradient, idx) => (
|
{gradients.map((gradient, idx) => (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue