MCPcopy
hub / github.com/remotely-save/remotely-save / getAndSaveProEmail

Function getAndSaveProEmail

pro/src/account.ts:194–215  ·  view source on GitHub ↗
(
  config: ProConfig,
  pluginVersion: string,
  saveUpdatedConfigFunc: () => Promise<any> | undefined
)

Source from the content-addressed store, hash-verified

192};
193
194export const getAndSaveProEmail = async (
195 config: ProConfig,
196 pluginVersion: string,
197 saveUpdatedConfigFunc: () => Promise<any> | undefined
198) => {
199 const access = await getAccessToken(config, saveUpdatedConfigFunc);
200
201 const resp1 = await fetch(`${site}/api/v1/profile/list`, {
202 method: "GET",
203 headers: {
204 Authorization: `Bearer ${access}`,
205 "REMOTELYSAVE-API-Plugin-Ver": pluginVersion,
206 },
207 });
208 const rsp2: {
209 email: string;
210 } = await resp1.json();
211
212 config.email = rsp2.email;
213 await saveUpdatedConfigFunc?.();
214 return rsp2;
215};
216
217/**
218 * If the check doesn't pass, the function should throw the error

Callers 2

onloadMethod · 0.90
onOpenMethod · 0.90

Calls 1

getAccessTokenFunction · 0.70

Tested by

no test coverage detected