Commit 6c2102e9 by G

fix somes types typo around naming convention. ex : firstName -> first_name

parent 6a0aa9cd
......@@ -16,16 +16,20 @@ export const UserAuthenticationContext = createContext<UserAuthenticationContext
userInformations: {
username: "",
email: "",
firstName: "",
lastName: "",
// biome-ignore lint/style/useNamingConvention: <Api response>
first_name: "",
// biome-ignore lint/style/useNamingConvention: <Api response>
last_name: "",
marchand: {
// biome-ignore lint/style/useNamingConvention: <Api reponse>
// biome-ignore lint/style/useNamingConvention: <Api response>
marchand_id: "",
nom: "",
code: "",
adresse: "",
urlSuccess: "",
urlEchec: "",
// biome-ignore lint/style/useNamingConvention: <Api response>
url_success: "",
// biome-ignore lint/style/useNamingConvention: <Api response>
url_echec: "",
entreprise: 0,
user: 0,
},
......@@ -42,16 +46,20 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
const [userInformations, setUserInformations] = useState<IuserInformations>({
username: "JohnDoe",
email: "JohnDoe@example.com",
firstName: "John",
lastName: "Doe",
// biome-ignore lint/style/useNamingConvention: <Api response>
first_name: "John",
// biome-ignore lint/style/useNamingConvention: <Api response>
last_name: "Doe",
marchand: {
// biome-ignore lint/style/useNamingConvention: <Api response>
marchand_id: "id123",
nom: "Beasy",
code: "BEASY-EXAMPLE-1",
adresse: "Plateau 2, 1023, Immeuble Chardy",
urlSuccess: "https://example.com/success",
urlEchec: "https://example.com/echec",
// biome-ignore lint/style/useNamingConvention: <Api response>
url_success: "https://example.com/success",
// biome-ignore lint/style/useNamingConvention: <Api response>
url_echec: "https://example.com/echec",
entreprise: 0,
user: 0,
},
......
......@@ -42,10 +42,40 @@ const useTransactionsHistory = () => {
},
[data],
);
const filterDataByReference = (data: Transaction[], reference: string) => {
if (!data?.length) return [];
return data.filter(
(transaction) => transaction.reference.includes(reference) && transaction.reference,
);
};
const filterByOperators = (data: Transaction[]) => {
if (!data?.length) return [];
// create a set
const set = new Set<PaymentCode>();
for (const key of Object.keys(operatorsFilter)) {
if (operatorsFilter[key as keyof OperatorsFilter]) {
set.add(key as PaymentCode);
}
}
return data.filter((transaction) => {
// return true if the set is empty, as there is no need to check
if (set.size === 0) return true;
// return true if the set contains the value
return set.has(transaction.type_paiement_label);
});
};
const transactionsHistory: Transaction[] = useMemo(() => {
if (!data) return [];
return filterByReference(referenceFilter);
}, [data, filterByReference, referenceFilter]);
const filteredByOperators = filterByOperators(data);
const filteredByReference = filterDataByReference(filteredByOperators, referenceFilter);
return filteredByReference;
// return filterByReference(referenceFilter);
}, [data, referenceFilter, filterByOperators, filterDataByReference]);
return {
transactionsHistory,
......
......@@ -45,7 +45,7 @@ const UserProfileScreen = () => {
<Box height={"100%"} flex={1} flexDirection={"column"}>
<Text fontWeight={"bold"} variant={"black"} fontSize={20}>
{userInformations.firstName} {userInformations.lastName}
{userInformations.first_name} {userInformations.last_name}
</Text>
<Text>{userInformations.email}</Text>
</Box>
......@@ -138,7 +138,9 @@ const UserProfileScreen = () => {
<Text variant={"black"} fontWeight={"bold"}>
Url succès
</Text>
<Text textAlign={"center"}>{userInformations.marchand.urlSuccess}</Text>
<Text textAlign={"center"}>
{userInformations.marchand.url_success}
</Text>
</Box>
<Box
width={"100%"}
......@@ -150,7 +152,7 @@ const UserProfileScreen = () => {
<Text variant={"black"} fontWeight={"bold"}>
Url échec
</Text>
<Text textAlign={"center"}>{userInformations.marchand.urlEchec}</Text>
<Text textAlign={"center"}>{userInformations.marchand.url_echec}</Text>
</Box>
</Box>
</Box>
......
......@@ -19,8 +19,10 @@ export interface ImerchandInformations {
nom: string;
code: string;
adresse: string;
urlSuccess: string;
urlEchec: string;
// biome-ignore lint/style/useNamingConvention: <Api response>
url_success: string;
// biome-ignore lint/style/useNamingConvention: <Api response>
url_echec: string;
entreprise: number;
user: number;
}
......@@ -28,7 +30,9 @@ export interface ImerchandInformations {
export interface IuserInformations {
username: string;
email: string;
firstName: string;
lastName: string;
// biome-ignore lint/style/useNamingConvention: <Api response>
first_name: string;
// biome-ignore lint/style/useNamingConvention: <Api response>
last_name: string;
marchand: ImerchandInformations;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment