Browse Source

feat(UpdateUserInfoScreen): set getInstitutions

feat/institutions_data_from_api
bobmw 7 months ago
parent
commit
1c8422c80e
  1. 22
      src/app/screens/UpdateUserInfoScreen.js

22
src/app/screens/UpdateUserInfoScreen.js

@ -4,7 +4,6 @@ import moment from "moment";
import Screen from '../components/Screen';
import SearchablePicker from '../components/SearchablePicker';
import FormDatePicker from '../components/forms/FormDatePicker';
import institutions from "../assets/institutions";
import defaultStyles from "../config/styles";
import constants from "../config/constants";
import ConfirmationModal from '../components/ConfirmationModal';
@ -19,6 +18,7 @@ import { states, statesToCities } from "../assets/cities_states";
import PasswordFormField from "../components/forms/PasswordFormField";
import storage from "../auth/storage";
import { AuthContext } from "../auth/context";
import { getInstitutions } from "../api/fetchInstutions";
//#region PICKERS
@ -27,6 +27,16 @@ function InstitutionNamePicker({ name }) {
const state = values["state"];
const instType = values["institution"];
const [items, setItems] = useState([]);
const [institutions, setInstitutions] = useState([]);
useEffect(() => {
getInstitutions().then((data) => {
setInstitutions(data);
})
.catch((error) => {
console.error(error);
});
}, []);
useEffect(() => {
try {
@ -123,11 +133,11 @@ function CityPicker({ name }) {
function InstitutionPicker({ name }) {
const [items, setItems] = useState([
{ value: "E", label: "Escola" },
{ value: "D", label: "Defesa civil" },
{ value: "N", label: "Não governamental" },
{ value: "O", label: "Outra" },
{ value: "X", label: "Nenhuma" },
{ value: "SCHOOL", label: "Escola" },
{ value: "CIVIL_DEFENSE", label: "Defesa civil" },
{ value: "NGO", label: "Não governamental" },
{ value: "OTHER", label: "Outra" },
{ value: "X", label: "Nenhuma" }
]);
return (
<SearchablePicker

Loading…
Cancel
Save