baasic-sdk-javascript
Version:
JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
60 lines (59 loc) • 3.02 kB
JavaScript
;
/* globals module */
/**
* @module loginSocialRoute
* @description Baasic Login Social Route Definition provides Baasic route templates which can be expanded to Baasic REST URIs. Various services can use Baasic Login Social Route Definition to obtain needed routes while other routes will be obtained through HAL. By convention, all route services use the same function names as their corresponding services.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var inversify_1 = require("inversify");
var common_1 = require("../../common");
var contracts_1 = require("../../core/contracts");
var LoginSocialRoute = /** @class */ (function (_super) {
tslib_1.__extends(LoginSocialRoute, _super);
function LoginSocialRoute(appOptions) {
var _this = _super.call(this, appOptions) || this;
_this.appOptions = appOptions;
/**
* Social login get route with route and query parameters.
**/
_this.getRoute = 'login/social/{provider}/{?returnUrl}';
/**
* Social login post route with route and query parameters.
**/
_this.postRoute = 'login/social/{provider}/{?embed,fields,options}';
return _this;
}
/**
* Parses get social login route which can be expanded with additional items. Supported items are:
* - `provider` - Provider name or Id for which the login URL should be generated.
* - `returnUrl` - Redirect Uri for the provider which will be used when the user is redirected back to the application.
* @method
* @param provider Provider name or id for which the login URL should be generated.
* @param returnUrl Redirect Uri for the provider which will be used when the user is redirected back to the application.
* @example loginSocialRoute.get({ provider : '<provider>', returnUrl: '<returnUrl>' });
**/
LoginSocialRoute.prototype.get = function (provider, returnUrl) {
var params = {
provider: provider,
returnUrl: returnUrl
};
return _super.prototype.baseFind.call(this, this.getRoute, params);
};
/**
* Parses post social login route which can be expanded with additional items. Supported items are:
* - `provider` - Provider name or Id being used to login with.
* @method
* @example loginSocialClient.post({ provider : '<provider>' });
**/
LoginSocialRoute.prototype.post = function (provider, options) {
return _super.prototype.baseCreate.call(this, this.postRoute, { provider: provider, options: options });
};
LoginSocialRoute = tslib_1.__decorate([
inversify_1.injectable(),
tslib_1.__param(0, inversify_1.inject(contracts_1.TYPES.IAppOptions)),
tslib_1.__metadata("design:paramtypes", [Object])
], LoginSocialRoute);
return LoginSocialRoute;
}(common_1.BaseRoute));
exports.LoginSocialRoute = LoginSocialRoute;