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'; ...@@ -4,84 +4,35 @@ import { layoutStyles } from 'styles';
import { ClientCardNutritionist } from './components'; import { ClientCardNutritionist } from './components';
import { useNavigation } from '@react-navigation/native'; import { useNavigation } from '@react-navigation/native';
import * as ROUTES from 'constants/routes'; import * as ROUTES from 'constants/routes';
import { retrieveClientListApi } from 'services/profiles';
const ClientListNutritionist: FC = () => { const ClientListNutritionist: FC = () => {
const navigation = useNavigation(); const navigation = useNavigation();
const clients = retrieveClientListApi();
return ( return (
<ScrollView style={layoutStyles}> <ScrollView style={layoutStyles}>
<ClientCardNutritionist {clients.map((client, idx) => (
clientName="Kefas Satrio Bangkit Solideantyo" <ClientCardNutritionist
onPressClientProfile={() => { key={idx}
navigation.navigate(ROUTES.clientProfileNutritionist, { clientName={client.name}
id: 1, onPressClientProfile={() => {
}); navigation.navigate(ROUTES.clientProfileNutritionist, {
}} id: client.id,
onPressClientDietReport={() => { });
navigation.navigate(ROUTES.clientDietReportNutritionist, { }}
id: 1, onPressClientDietReport={() => {
}); navigation.navigate(ROUTES.clientDietReportNutritionist, {
}} id: client.id,
onPressClientChat={() => { });
navigation.navigate(ROUTES.clientChatNutritionist, { }}
id: 1, onPressClientChat={() => {
}); navigation.navigate(ROUTES.clientChatNutritionist, {
}} id: client.id,
/> });
<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,
});
}}
/>
</ScrollView> </ScrollView>
); );
}; };
......
...@@ -23,6 +23,7 @@ export interface CartResponse { ...@@ -23,6 +23,7 @@ export interface CartResponse {
unique_code: DietelaProgram; unique_code: DietelaProgram;
}; };
nutritionist: Nutritionist; nutritionist: Nutritionist;
user: number;
} }
export interface MidtransResponse { 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/';
Supports Markdown
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