@appello/services
Version:
Services package with api / graphql
20 lines (19 loc) • 792 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.refreshTokens = void 0;
const consts_1 = require("../../consts");
const refreshTokens = async (config) => {
var _a;
const refreshToken = await config.getRefreshToken();
const error = new Error((config === null || config === void 0 ? void 0 : config.refreshTokenErrorMessage) || consts_1.DEFAULT_REFRESH_TOKEN_ERROR_MESSAGE);
if (!refreshToken || !consts_1.gqlClient.client) {
throw error;
}
const context = { withoutAuth: true };
const auth = await ((_a = config.refreshTokens) === null || _a === void 0 ? void 0 : _a.call(config, consts_1.gqlClient.client, context));
if (auth) {
return auth;
}
throw error;
};
exports.refreshTokens = refreshTokens;