assign data before returning value

This commit is contained in:
dkanada 2020-04-02 19:50:09 +09:00
parent 20391c52e3
commit 0a6fefd417

View File

@ -3,7 +3,8 @@ let data;
function getConfig() {
if (data) return Promise.resolve(data);
return fetch("/config.json?nocache=" + new Date().getUTCMilliseconds()).then(function (response) {
return response.json();
data = response.json();
return data;
});
}