@bananacool467/authtics 1.0.23 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +20 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.authtics = exports.getAccount = void 0;
18
18
  const child_process_1 = require("child_process");
19
+ const react_1 = require("react");
19
20
  const cookieParser = require("cookie-parser");
20
21
  const __runCurl__ = (url_1, ...args_1) => __awaiter(void 0, [url_1, ...args_1], void 0, function* (url, headers = []) {
21
22
  var outp;
@@ -46,20 +47,25 @@ const getAccount = (accessToken, clientId, clientSecret, userIp) => __awaiter(vo
46
47
  exports.getAccount = getAccount;
47
48
  exports.authtics = {
48
49
  useAccount: () => __awaiter(void 0, void 0, void 0, function* () {
49
- var account = {};
50
- const a = yield fetch('/api/authtics-integration/get-account', {
51
- method: 'POST',
52
- headers: {
53
- "Content-Type": "application/json"
54
- },
55
- body: JSON.stringify({})
56
- });
57
- if (a.status != 200) {
58
- account = {};
59
- }
60
- else {
61
- account = yield a.json();
62
- }
50
+ const [account, setAccount] = (0, react_1.useState)({});
51
+ (0, react_1.useEffect)(() => {
52
+ const getAccount = () => __awaiter(void 0, void 0, void 0, function* () {
53
+ const a = yield fetch('/api/authtics-integration/get-account', {
54
+ method: 'POST',
55
+ headers: {
56
+ "Content-Type": "application/json"
57
+ },
58
+ body: JSON.stringify({})
59
+ });
60
+ if (a.status != 200) {
61
+ setAccount({});
62
+ }
63
+ else {
64
+ setAccount(yield a.json());
65
+ }
66
+ });
67
+ getAccount();
68
+ }, []);
63
69
  const carriedInfo = {
64
70
  action: null,
65
71
  failed: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananacool467/authtics",
3
- "version": "1.0.23",
3
+ "version": "1.0.27",
4
4
  "description": "Use Authtics (An Auth service) to add accounts to your site like Auth0! (This is currently underdevelopment. Issues are expected.)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",