Fakultas Ilmu Komputer UI

Commit c3abd2a5 authored by Kefas Satrio Bangkit Solidedantyo's avatar Kefas Satrio Bangkit Solidedantyo
Browse files

integrate client list with backend

parent add3980a
......@@ -4,84 +4,35 @@ import { layoutStyles } from 'styles';
import { ClientCardNutritionist } from './components';
import { useNavigation } from '@react-navigation/native';
import * as ROUTES from 'constants/routes';
import { retrieveClientListApi } from 'services/profiles';
const ClientListNutritionist: FC = () => {
const navigation = useNavigation();
const clients = retrieveClientListApi();
return (
<ScrollView style={layoutStyles}>
<ClientCardNutritionist
clientName="Kefas Satrio Bangkit Solideantyo"
onPressClientProfile={() => {
navigation.navigate(ROUTES.clientProfileNutritionist, {
id: 1,
});
}}
onPressClientDietReport={() => {
navigation.navigate(ROUTES.clientDietReportNutritionist, {
id: 1,
});
}}
onPressClientChat={() => {
navigation.navigate(ROUTES.clientChatNutritionist, {
id: 1,
});
}}
/>
<ClientCardNutritionist
clientName="Doan Di Dinding"
onPressClientProfile={() => {
navigation.navigate(ROUTES.clientProfileNutritionist, {
id: 2,
});
}}
onPressClientDietReport={() => {
navigation.navigate(ROUTES.clientDietReportNutritionist, {
id: 2,
});
}}
onPressClientChat={() => {
navigation.navigate(ROUTES.clientChatNutritionist, {
id: 2,
});
}}
/>
<ClientCardNutritionist
clientName="Shin Ryujin"
onPressClientProfile={() => {
navigation.navigate(ROUTES.clientProfileNutritionist, {
id: 3,
});
}}
onPressClientDietReport={() => {
navigation.navigate(ROUTES.clientDietReportNutritionist, {
id: 3,
});
}}
onPressClientChat={() => {
navigation.navigate(ROUTES.clientChatNutritionist, {
id: 3,
});
}}
/>
<ClientCardNutritionist
clientName="Nais"
onPressClientProfile={() => {
navigation.navigate(ROUTES.clientProfileNutritionist, {
id: 4,
});
}}
onPressClientDietReport={() => {
navigation.navigate(ROUTES.clientDietReportNutritionist, {
id: 4,
});
}}
onPressClientChat={() => {
navigation.navigate(ROUTES.clientChatNutritionist, {
id: 4,
});
}}
/>
{clients.map((client, idx) => (
<ClientCardNutritionist
key={idx}
clientName={client.name}
onPressClientProfile={() => {
navigation.navigate(ROUTES.clientProfileNutritionist, {
id: client.id,
});
}}
onPressClientDietReport={() => {
navigation.navigate(ROUTES.clientDietReportNutritionist, {
id: client.id,
});
}}
onPressClientChat={() => {
navigation.navigate(ROUTES.clientChatNutritionist, {
id: client.id,
});
}}
/>
))}
</ScrollView>
);
};
......
......@@ -23,6 +23,7 @@ export interface CartResponse {
unique_code: DietelaProgram;
};
nutritionist: Nutritionist;
user: number;
}
export interface MidtransResponse {
......
import { api, RequestMethod, ApiResponse } from '../api';
import * as apiUrls from './urls';
import { Client } from './models';
export const retrieveClientListApi = (): ApiResponse<Client[]> => {
return api(RequestMethod.GET, apiUrls.profiles);
};
import { UserRole } from 'services/auth/models';
import { CartResponse } from 'services/payment/models';
export interface Client {
id: number | null;
email: string;
name: string;
role: UserRole | null;
cart: CartResponse;
}
export const profiles = 'profiles/';
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