-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renovation: odata/mixins es6 refactoring (#11444)
- Loading branch information
1 parent
5ccb47d
commit d6be4df
Showing
6 changed files
with
116 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { sendRequest } from './utils'; | ||
import './query_adapter'; | ||
|
||
const DEFAULT_PROTOCOL_VERSION = 2; | ||
|
||
export default class RequestDispatcher { | ||
constructor(options) { | ||
options = options || {}; | ||
|
||
this._url = String(options.url).replace(/\/+$/, ''); | ||
this._beforeSend = options.beforeSend; | ||
this._jsonp = options.jsonp; | ||
this._version = options.version || DEFAULT_PROTOCOL_VERSION; | ||
this._withCredentials = options.withCredentials; | ||
this._deserializeDates = options.deserializeDates; | ||
this._filterToLower = options.filterToLower; | ||
} | ||
|
||
sendRequest(url, method, params, payload) { | ||
return sendRequest(this.version, | ||
{ | ||
url, | ||
method, | ||
params: params || {}, | ||
payload | ||
}, | ||
{ | ||
beforeSend: this._beforeSend, | ||
jsonp: this._jsonp, | ||
withCredentials: this._withCredentials, | ||
deserializeDates: this._deserializeDates | ||
} | ||
); | ||
} | ||
|
||
get version() { | ||
return this._version; | ||
} | ||
|
||
get beforeSend() { | ||
return this._beforeSend; | ||
} | ||
|
||
get url() { | ||
return this._url; | ||
} | ||
|
||
get jsonp() { | ||
return this._jsonp; | ||
} | ||
|
||
get filterToLower() { | ||
return this._filterToLower; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters