321
Views
5
Comments
Solved
[Google Maps Library] apikey
Question
google-maps-mobile
Reactive icon
Forge asset by Labs

How to set the apikey outside the OnInitialize. Because i only can get the apikey from local storage

2018-01-05 02-53-30
Grayson Udstrand
Solution

Filipe,

Use a data fetch from local storage - this way you can also block UI rendering until the data is retrieved using an if statement.

You can set up synchronization logic to retrieve this property from the server only every once in a while and save it into local storage. This seems like a pretty good option to me. 

--
Grayson

2021-01-27 16-01-28
Rodolfo Póvoa Leal
Champion

Hello Filipe,


The first step is create a Site Properties called ApiKey, and set you ApiKey Google Maps in this Site Properties.



The second step you can create public action with output parameter ApiKey:

To finish, assign the ApiKey:

I think that this solution is a best practice to solve your problem.


Have a nice day :)

Rodolfo Póvoa Leal

2024-01-05 16-00-17
Filipe Lourenço

I think you didnt understand. I am not asking how to get the apikey, i have the action. I just want to know a way of calling this action outside the oninitialize

2021-01-27 16-01-28
Rodolfo Póvoa Leal
Champion

Filipe Lourenço wrote:

I think you didnt understand. I am not asking how to get the apikey, i have the action. I just want to know a way of calling this action outside the oninitialize

I'm sorry Filipe, i thought i had not done that step yet. If you do not want to call the action that returns ApiKey in  OnInitialize, for some functional requirement, you call it when you need to load the map and call the Maps API.

If the answer is not what you expected, please explain in more detail why you need do call this acation outside on OnInitialize.


Best regards

R.P


2024-01-05 16-00-17
Filipe Lourenço

The map is to be shown initially but loading the apikey in the oninitialize will do a server call and against best practices

2018-01-05 02-53-30
Grayson Udstrand
Solution

Filipe,

Use a data fetch from local storage - this way you can also block UI rendering until the data is retrieved using an if statement.

You can set up synchronization logic to retrieve this property from the server only every once in a while and save it into local storage. This seems like a pretty good option to me. 

--
Grayson

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.