UNPKG

@openauth/kakao

Version:
31 lines 1.34 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.KakaoClient = void 0; const core_1 = require("@openauth/core"); class KakaoClient extends core_1.Client { request(method, path, params = {}, headers = {}) { return super.request(method, path, params, headers).then((response) => { if (response.status >= 400) { const _a = response.data, { error_description: description, error_code: code } = _a, errorProps = __rest(_a, ["error_description", "error_code"]); throw Object.assign(new Error(description || 'Error occured'), Object.assign({ code }, errorProps)); } return response; }); } getUserMe() { return this.get('user/me'); } } exports.KakaoClient = KakaoClient; //# sourceMappingURL=kakao-client.js.map