UNPKG

@haechi-labs/henesis-cli

Version:

🚀 Command Line Interface tool to Utilize henesis

20 lines • 763 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const configstore_1 = tslib_1.__importDefault(require("../../common/configstore")); const wretch_1 = require("../../rpc/wretch"); // set for nodejs const hook = async function (opts) { const isExistUser = configstore_1.default.has('user'); if (isExistUser) { const user = configstore_1.default.get('user'); wretch_1.setWretcher(wretch_1.getWretcher() .auth(`Bearer ${user.jwtToken}`) .catcher(401, () => { configstore_1.default.delete('user'); throw new Error('expired token (please log in again)'); })); } }; exports.default = hook; //# sourceMappingURL=wretch.js.map