mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Use async version of machineId + refactoring
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
795b490d70
commit
24f6aabc49
@ -12,7 +12,7 @@ export class SurveyPreferenceInput extends React.Component<{survey: SurveyPrefer
|
|||||||
<Component.Checkbox
|
<Component.Checkbox
|
||||||
label="Allow in-app surveys"
|
label="Allow in-app surveys"
|
||||||
value={survey.enabled}
|
value={survey.enabled}
|
||||||
onChange={v => { survey.enabled = v; }}
|
onChange={v => survey.enabled = v }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Util } from "@k8slens/extensions";
|
import { Util } from "@k8slens/extensions";
|
||||||
import { machineIdSync } from "node-machine-id";
|
import { machineId } from "node-machine-id";
|
||||||
import Refiner from "refiner-js";
|
import Refiner from "refiner-js";
|
||||||
import got from "got";
|
import got from "got";
|
||||||
import { surveyPreferencesStore } from "./survey-preferences-store";
|
import { surveyPreferencesStore } from "./survey-preferences-store";
|
||||||
@ -32,7 +32,7 @@ export class Survey extends Util.Singleton {
|
|||||||
async fetchSurveyId() {
|
async fetchSurveyId() {
|
||||||
try {
|
try {
|
||||||
const surveyApi = process.env.SURVEY_API_URL || "https://survey.k8slens.dev";
|
const surveyApi = process.env.SURVEY_API_URL || "https://survey.k8slens.dev";
|
||||||
const anonymousId = machineIdSync();
|
const anonymousId = await machineId();
|
||||||
const { body } = await got(`${surveyApi}/api/survey-id?anonymousId=${anonymousId}`, { responseType: "json"});
|
const { body } = await got(`${surveyApi}/api/survey-id?anonymousId=${anonymousId}`, { responseType: "json"});
|
||||||
|
|
||||||
return (body as SurveyIdResponse).surveyId;
|
return (body as SurveyIdResponse).surveyId;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user