1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-03 18:50:05 +00:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Allan Bowe
9ed64e5a2c Merge pull request #42 from sasjs/issue41
fix: csrfTokenWeb setter callback
2020-08-18 13:22:33 +02:00
Mihajlo Medjedovic
0479a5d651 fix: csrfTokenWeb setter callback 2020-08-18 13:17:29 +02:00
Allan Bowe
005f10bb47 Update CONTRIBUTING.md 2020-08-18 11:24:30 +02:00
Krishna Acondy
8192f69f67 fix(*): do not use polyfill when running on Node.js 2020-08-18 08:25:40 +01:00
Krishna Acondy
a409d8cdb6 Merge pull request #38 from sasjs/brwoserCheckFix
fix: isIEorEdgeOrOldFirefox error
2020-08-14 13:10:44 +01:00
Mihajlo Medjedovic
618a20eaba fix: isIEorEdgeOrOldFirefox error 2020-08-14 14:09:28 +02:00
4 changed files with 27 additions and 4 deletions

View File

@@ -70,6 +70,14 @@ parmcards4;
%webout(CLOSE) %webout(CLOSE)
;;;; ;;;;
%mp_createwebservice(path=/Public/app/common,name=sendArr) %mp_createwebservice(path=/Public/app/common,name=sendArr)
filename ft15f001 temp;
parmcards4;
If you can keep your head when all about you
Are losing theirs and blaming it on you,
If you can trust yourself when all men doubt you,
But make allowance for their doubting too;
;;;;
%mp_createwebservice(path=/Public/app/common,name=makeErr)
``` ```
The above services will return anything you send. To run the tests simply launch `npm run cypress`. The above services will return anything you send. To run the tests simply launch `npm run cypress`.

View File

@@ -9,7 +9,8 @@ export class FileUploader {
private appLoc: string, private appLoc: string,
private serverUrl: string, private serverUrl: string,
private jobsPath: string, private jobsPath: string,
private csrfToken: CsrfToken | null = null private setCsrfTokenWeb: any,
private csrfToken: CsrfToken | null = null,
) {} ) {}
private retryCount = 0; private retryCount = 0;
@@ -61,6 +62,8 @@ export class FileUploader {
headerName: tokenHeader, headerName: tokenHeader,
value: token || "", value: token || "",
}; };
this.setCsrfTokenWeb(this.csrfToken);
} }
} }
} }

View File

@@ -1,7 +1,10 @@
import { isIEorEdgeOrOldFirefox } from "./utils/isIeOrEdge";
import * as e6p from "es6-promise"; import * as e6p from "es6-promise";
(e6p as any).polyfill(); (e6p as any).polyfill();
if (isIEorEdgeOrOldFirefox()) { if (isIEorEdgeOrOldFirefox()) {
window.fetch = undefined as any; // ensure the polyfill runs if (window) {
window.fetch = undefined as any; // ensure the polyfill runs
}
} }
// tslint:disable-next-line // tslint:disable-next-line
require("isomorphic-fetch"); require("isomorphic-fetch");
@@ -31,7 +34,6 @@ import {
import { SASViyaApiClient } from "./SASViyaApiClient"; import { SASViyaApiClient } from "./SASViyaApiClient";
import { SAS9ApiClient } from "./SAS9ApiClient"; import { SAS9ApiClient } from "./SAS9ApiClient";
import { FileUploader } from "./FileUploader"; import { FileUploader } from "./FileUploader";
import { isIEorEdgeOrOldFirefox } from "./utils/isIeOrEdge";
const defaultConfig: SASjsConfig = { const defaultConfig: SASjsConfig = {
serverUrl: "", serverUrl: "",
@@ -397,8 +399,10 @@ export default class SASjs {
this.sasjsConfig.appLoc, this.sasjsConfig.appLoc,
this.sasjsConfig.serverUrl, this.sasjsConfig.serverUrl,
this.jobsPath, this.jobsPath,
this.setCsrfTokenWeb,
this.csrfTokenWeb this.csrfTokenWeb
); );
return fileUploader.uploadFile(sasJob, files, params); return fileUploader.uploadFile(sasJob, files, params);
} }
@@ -909,6 +913,10 @@ export default class SASjs {
return sasjsWaitingRequest.requestPromise.promise; return sasjsWaitingRequest.requestPromise.promise;
} }
private setCsrfTokenWeb = (csrfToken: CsrfToken) => {
this.csrfTokenWeb = csrfToken;
};
private setCsrfTokenApi = (csrfToken: CsrfToken) => { private setCsrfTokenApi = (csrfToken: CsrfToken) => {
this.csrfTokenApi = csrfToken; this.csrfTokenApi = csrfToken;
@@ -1175,7 +1183,8 @@ export default class SASjs {
this.fileUploader = new FileUploader( this.fileUploader = new FileUploader(
this.sasjsConfig.appLoc, this.sasjsConfig.appLoc,
this.sasjsConfig.serverUrl, this.sasjsConfig.serverUrl,
this.jobsPath this.jobsPath,
this.setCsrfTokenWeb
); );
} }

View File

@@ -1,4 +1,7 @@
export function isIEorEdgeOrOldFirefox() { export function isIEorEdgeOrOldFirefox() {
if (typeof window === "undefined") {
return false;
}
const ua = window.navigator.userAgent; const ua = window.navigator.userAgent;
if (ua.indexOf("Firefox") > 0) { if (ua.indexOf("Firefox") > 0) {