Fakultas Ilmu Komputer UI

Commit a310eaf5 authored by Wulan Mantiri's avatar Wulan Mantiri
Browse files

Merge branch 'fix-internet-connection-on-fetch-data' into 'staging'

Fix internet and request header config for API request

See merge request !17
parents 41e359cb 571637b1
Pipeline #68360 passed with stages
in 24 minutes and 34 seconds
......@@ -187,7 +187,6 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dietela_mobile">
......@@ -9,7 +10,9 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
......
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
......@@ -30,7 +30,7 @@ const MultipleCheckbox: FC<Props> = ({
Pertanyaan {questionNumber} / {totalQuestions}
</Text>
<Text style={[typographyStyles.headingLarge, styles.spacing]}>
{questionLabel} <Text style={styles.red}>*</Text>
{questionLabel}
</Text>
<Text
style={[
......@@ -38,7 +38,7 @@ const MultipleCheckbox: FC<Props> = ({
styles.bigSpacing,
errorMessage ? styles.red : null,
]}>
{helperText || 'Pilih semua yang berlaku'}
{helperText || 'Pilih semua yang berlaku (opsional)'}
</Text>
{choices.map((choice) => (
<CheckBox
......
......@@ -242,10 +242,8 @@ export const allAccessQuestions = [
{
fieldName: 'health_problem',
questionLabel: 'Masalah kesehatan yang kamu miliki?',
helperText: 'Pilih semua yang berlaku',
multiple: true,
choiceList: [
'Tidak ada yang perlu dikhawatirkan',
'Diabetes Tipe 2',
'Diabetes Tipe 1',
'PCOS (Polycystic Ovary Syndrome)',
......@@ -275,10 +273,12 @@ export const fieldValidations: FieldValidation[] = [
label: field.label,
type: FieldType.RADIO_BUTTON,
})),
...allAccessQuestions.map((field) => ({
name: field.fieldName,
type: field.multiple ? FieldType.CHECKBOX : FieldType.RADIO_BUTTON,
})),
...allAccessQuestions
.filter((field) => !field.multiple)
.map((field) => ({
name: field.fieldName,
type: FieldType.RADIO_BUTTON,
})),
];
export const convertPayload = (
......@@ -288,4 +288,6 @@ export const convertPayload = (
age: parseInt(values.age, 10),
height: parseInt(values.age, 10),
weight: parseInt(values.age, 10),
health_problem:
values.health_problem.length === 0 ? [1] : values.health_problem,
});
......@@ -25,7 +25,11 @@ export async function api<T>(
url: `https://dietela-backend.herokuapp.com/${url}`,
method,
data: JSON.stringify(body),
headers,
headers: {
Accept: 'application/json',
'Content-Type': 'application/json;charset=UTF-8',
...headers,
},
};
return await axios
......
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