Expose is-logged-in endpoint
Summary: Make it possible to ask whether a user is logged in. This won't tackle token expiration but it's consistent with the internal API we have through the `isLoggedIn` atom. Reviewed By: lblasa Differential Revision: D37422274 fbshipit-source-id: 2d3a5e27f5dbbe866d5392403e690faf2f1156b2
This commit is contained in:
committed by
Facebook GitHub Bot
parent
afc51c00a9
commit
9a72169819
@@ -302,6 +302,7 @@ export type FlipperServerCommands = {
|
||||
messages: {category: string; message: string}[],
|
||||
) => Promise<void>;
|
||||
shutdown: () => Promise<void>;
|
||||
'is-logged-in': () => Promise<boolean>;
|
||||
};
|
||||
|
||||
export type GraphResponse = {
|
||||
|
||||
@@ -481,6 +481,14 @@ export class FlipperServerImpl implements FlipperServer {
|
||||
shutdown: async () => {
|
||||
process.exit(0);
|
||||
},
|
||||
'is-logged-in': async () => {
|
||||
try {
|
||||
const token = await this.keytarManager.retrieveToken(SERVICE_FLIPPER);
|
||||
return !!token;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
registerDevice(device: ServerDevice) {
|
||||
|
||||
Reference in New Issue
Block a user