I'm trying to assemble a function to list all states and then print inside an object. Sorry to be so noob, I think it's a pretty silly problem.
States
function listarTodasOsEstados(){
var estado = [
'AC',
'AL',
'AP',
'AM',
'BA',
'CE',
'DF',
'ES',
'GO',
'MA',
'MT',
'MS',
'MG',
'PA',
'PB',
'PR',
'PE',
'PI',
'RJ',
'RN',
'RS',
'RO',
'RR',
'SC',
'SP',
'SE',
'TO'
]
var mostrar_para_o_painel = console.log(estado);
return mostrar_para_o_painel;
};
Context:
User.add({
estado: { Types.Select, options: listarTodasOsEstados(), label:"Estado", initial:true} })
Result:
/home/pedromagalhaes/Projects/Projeto_Ag2/node_modules/keystone/fields/types/select/SelectType.js:21
throw new Error('Select fields require an options array.');
^