Skip to content

Commit

Permalink
fixes bug - removes async from sessionPossiblyExists function. Fixes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar committed Dec 14, 2019
1 parent 17f4b45 commit f2dd4ef
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 32 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.0.0] - 2019-07-10
### Added
- handling of anti-csrf token
- package testing
- package testing

## [3.2.8] - 2019-12-14
### Changed
- changes sessionPossiblyExists to be non async. Credit @eweitnauer for finding this bug.
2 changes: 1 addition & 1 deletion axios.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ export default class AuthHttpRequest {
maybeConfig?: AxiosRequestConfig | undefined
) => Promise<AxiosResponse<any>>;
static makeSuper: (axiosInstance: any) => void;
static sessionPossiblyExists: () => Promise<boolean>;
static sessionPossiblyExists: () => boolean;
}
8 changes: 2 additions & 6 deletions axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
var axios_1 = require("axios");
var _1 = require(".");
var handleSessionExp_1 = require("./handleSessionExp");
var constants_1 = require("./constants");
var handleSessionExp_1 = require("./handleSessionExp");
function interceptorFunctionRequestFulfilled(config) {
return __awaiter(this, void 0, void 0, function() {
var url, preRequestIdToken, antiCsrfToken, configWithAntiCsrf;
Expand Down Expand Up @@ -590,11 +590,7 @@ var AuthHttpRequest = /** @class */ (function() {
);
};
AuthHttpRequest.sessionPossiblyExists = function() {
return __awaiter(_this, void 0, void 0, function() {
return __generator(this, function(_a) {
return [2 /*return*/, handleSessionExp_1.getIDFromCookie() !== undefined];
});
});
return handleSessionExp_1.getIDFromCookie() !== undefined;
};
return AuthHttpRequest;
})();
Expand Down
4 changes: 2 additions & 2 deletions axios.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import axios, { AxiosPromise, AxiosRequestConfig, AxiosResponse } from "axios";

import FetchAuthRequest, { AntiCsrfToken, getDomainFromUrl, handleUnauthorised } from ".";
import { package_version, platform_name } from "./constants";
import { getIDFromCookie } from "./handleSessionExp";
import { platform_name, package_version } from "./constants";

async function interceptorFunctionRequestFulfilled(config: AxiosRequestConfig) {
let url = config.url;
Expand Down Expand Up @@ -352,7 +352,7 @@ export default class AuthHttpRequest {
);
};

static sessionPossiblyExists = async () => {
static sessionPossiblyExists = () => {
return getIDFromCookie() !== undefined;
};
}
8 changes: 0 additions & 8 deletions bundle/bundle-3.2.7.js

This file was deleted.

8 changes: 8 additions & 0 deletions bundle/bundle-3.2.8.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion constants.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export declare const package_version = "3.2.7";
export declare const package_version = "3.2.8";
export declare const platform_name = "website";
2 changes: 1 addition & 1 deletion constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.package_version = "3.2.7";
exports.package_version = "3.2.8";
exports.platform_name = "website";
2 changes: 1 addition & 1 deletion constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const package_version = "3.2.7";
export const package_version = "3.2.8";
export const platform_name = "website";
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ export default class AuthHttpRequest {
static delete: (url: RequestInfo, config?: RequestInit | undefined) => Promise<Response>;
static put: (url: RequestInfo, config?: RequestInit | undefined) => Promise<Response>;
static fetch: (url: RequestInfo, config?: RequestInit | undefined) => Promise<Response>;
static sessionPossiblyExists: () => Promise<boolean>;
static sessionPossiblyExists: () => boolean;
}
8 changes: 2 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ var __generator =
};
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
var handleSessionExp_1 = require("./handleSessionExp");
var constants_1 = require("./constants");
var handleSessionExp_1 = require("./handleSessionExp");
var AntiCsrfToken = /** @class */ (function() {
function AntiCsrfToken() {}
AntiCsrfToken.getToken = function(associatedIdRefreshToken) {
Expand Down Expand Up @@ -500,11 +500,7 @@ var AuthHttpRequest = /** @class */ (function() {
});
};
AuthHttpRequest.sessionPossiblyExists = function() {
return __awaiter(_this, void 0, void 0, function() {
return __generator(this, function(_a) {
return [2 /*return*/, handleSessionExp_1.getIDFromCookie() !== undefined];
});
});
return handleSessionExp_1.getIDFromCookie() !== undefined;
};
return AuthHttpRequest;
})();
Expand Down
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { package_version, platform_name } from "./constants";
import { getIDFromCookie, onUnauthorisedResponse } from "./handleSessionExp";
import { platform_name, package_version } from "./constants";

export class AntiCsrfToken {
private static tokenInfo:
Expand Down Expand Up @@ -292,7 +292,7 @@ export default class AuthHttpRequest {
);
};

static sessionPossiblyExists = async () => {
static sessionPossiblyExists = () => {
return getIDFromCookie() !== undefined;
};
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supertokens-website",
"version": "3.2.7",
"version": "3.2.8",
"description": "frontend sdk for website to be used for auth solution.",
"main": "index.js",
"dependencies": {
Expand Down Expand Up @@ -62,4 +62,4 @@
"url": "https://github.com/supertokens/supertokens-website/issues"
},
"homepage": "https://github.com/supertokens/supertokens-website#readme"
}
}

0 comments on commit f2dd4ef

Please sign in to comment.