osm-api
Version:
πΊοΈπ Javascript/Typescript wrapper around the OpenStreetMap API
20 lines (19 loc) β’ 884 B
TypeScript
import type { LoginData, LoginOptions } from "./types";
/**
* If mode = `redirect`, this function will never resolve, and will
* redirect to openstreetmap.org instead.
*
* If mode = `popup`, this function will resolve once the popup is
* succesfully closed. It may reject if an error occurs durnig login.
*/
export declare function login(options: LoginOptions): Promise<LoginData>;
/**
* if you used the `redirect` method to login, you need to await this variable
* before you can safely determine if a user is logged in or not.
*/
export declare const authReady: Promise<void>;
/** returns the OAuth2 `access_token` if the user is logged in, otherwise it returns `undefined` */
export declare const getAuthToken: () => string | undefined;
/** returns `true` if the user is logged in */
export declare const isLoggedIn: () => boolean;
export declare function logout(): void;