diff --git a/bob_party/src/components/Skin.tsx b/bob_party/src/components/Skin.tsx index 3a20fff..2caf613 100644 --- a/bob_party/src/components/Skin.tsx +++ b/bob_party/src/components/Skin.tsx @@ -7,6 +7,8 @@ import { Skin } from "../core/skin" Importing the correct stylesheet */ import styles from "./style/Skin.style" +import { useDispatch } from "react-redux" +import { updateSkin } from "../redux/features/currentUserSlice" export const SkinComponent : /* Parameters : @@ -16,6 +18,8 @@ export const SkinComponent : FC<{skin: Skin, state: String}> = ({skin, state}) => { + const dispatch=useDispatch(); + /* The display of this component depends of the screen from where it has been called: * From the TopBar (icon) : Small image in a circle * From the shop (shop) : Image + Name + Price, Pressable => Buy the skin @@ -25,7 +29,7 @@ FC<{skin: Skin, state: String}> = case 'icon': return ( - + ) @@ -42,7 +46,7 @@ FC<{skin: Skin, state: String}> = ) case 'liste': return( - Alert.alert("Changement du skin")} style={styles.imageWrapper}> + dispatch(updateSkin(skin))} style={styles.imageWrapper}> {skin.getSkinName()} = ) default: - break; + return( + + ) } } \ No newline at end of file