Fakultas Ilmu Komputer UI

Commit 40be33fc authored by Doan Andreas Nathanael's avatar Doan Andreas Nathanael
Browse files

[CHORES] resolve conflict with new files at staging

parents 84f1d827 fb23e8f5
Pipeline #70017 passed with stages
in 21 minutes and 13 seconds
......@@ -6,12 +6,20 @@ cache:
- ios/
stages:
- test
- lint
- test
- pbi-sonar-scanner
- sonar-scanner
- build
lint:
image: node:slim
stage: lint
before_script:
- yarn install
script:
- yarn lint
test:
image: node:slim
stage: test
......@@ -23,14 +31,6 @@ test:
paths:
- coverage
lint:
image: node:slim
stage: lint
before_script:
- yarn install
script:
- yarn lint
pbi-sonar-scanner:
image:
name: sonarsource/sonar-scanner-cli:latest
......
import React, { FC, useState } from 'react';
import { ScrollView } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import { useNavigation, useRoute } from '@react-navigation/native';
import { WizardContainer, Loader } from 'components/core';
......@@ -10,11 +9,12 @@ import { useForm, useApi } from 'hooks';
import { dietPrograms } from 'constants/dietelaProgram';
import { retrieveNutritionistsApi } from 'services/nutritionists';
import { Nutritionist } from 'services/nutritionists/models';
import { ProgramRecommendations } from 'services/dietelaQuiz/quizResult';
import { layoutStyles } from 'styles';
import { setCache } from 'utils/cache';
import { PricingList } from './components';
import { initialValues, getRecommendedPrograms } from './schema';
import { ProgramRecommendations } from 'services/dietelaQuiz/quizResult';
const ChoosePlan: FC = () => {
const navigation = useNavigation();
......@@ -25,15 +25,9 @@ const ChoosePlan: FC = () => {
const { handleSubmit, getFormFieldProps } = useForm({
initialValues,
onSubmit: async (values) => {
await AsyncStorage.setItem(
CACHE_KEYS.selectedProgramId,
`${values.program}`,
);
await AsyncStorage.setItem(
CACHE_KEYS.selectedNutritionistId,
`${values.nutritionist}`,
);
onSubmit: (values) => {
setCache(CACHE_KEYS.selectedProgramId, values.program);
setCache(CACHE_KEYS.selectedNutritionistId, values.nutritionist);
navigation.navigate(ROUTES.cart);
},
});
......
import React, { FC, useState } from 'react';
import { View } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import { useNavigation } from '@react-navigation/native';
import { WizardContainer, Toast } from 'components/core';
......@@ -21,6 +20,7 @@ import {
convertPayload,
} from './schema';
import { generateValidationSchema } from 'utils/form';
import { setCache } from 'utils/cache';
const AllAccessQuestionnaire: FC = () => {
const navigation = useNavigation();
......@@ -41,10 +41,7 @@ const AllAccessQuestionnaire: FC = () => {
const response = await createDietProfileApi(convertPayload(values));
if (response.success) {
await AsyncStorage.setItem(
CACHE_KEYS.dietProfileId,
`${response.data?.id}`,
);
setCache(CACHE_KEYS.dietProfileId, response.data?.id);
navigation.navigate(ROUTES.dietelaQuizResult, response.data);
} else {
Toast.show({
......
import AsyncStorage from '@react-native-community/async-storage';
import { ReactNode } from 'react';
export const setCache = async (
key: string,
value: ReactNode,
callback?: (error?: Error) => void,
) => await AsyncStorage.setItem(key, `${value}`, callback);
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