Comparing version 6.0.2 to 6.0.3
@@ -287,31 +287,32 @@ import { CustomError } from 'ts-custom-error'; | ||
dispatch(action) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const actionType = this.toPrimitiveAction(action.type); | ||
const path = this.isPrimitiveAction(action.type) | ||
? action.path | ||
: action.path + "/" + snakeCase(action.type); | ||
const encoding = this.inferEncoding(actionType, path); | ||
const meta = Object.assign(Object.assign({}, action.meta), { encoding }); | ||
switch (actionType) { | ||
case "fetch": { | ||
return this.http.get(path, action.data, meta); | ||
} | ||
case "create": { | ||
if (path === "/api/v2/media") { | ||
const media = yield this.http.post(path, action.data, meta); | ||
const actionType = this.toPrimitiveAction(action.type); | ||
const path = this.isPrimitiveAction(action.type) | ||
? action.path | ||
: action.path + "/" + snakeCase(action.type); | ||
const encoding = this.inferEncoding(actionType, path); | ||
const meta = Object.assign(Object.assign({}, action.meta), { encoding }); | ||
switch (actionType) { | ||
case "fetch": { | ||
return this.http.get(path, action.data, meta); | ||
} | ||
case "create": { | ||
if (path === "/api/v2/media") { | ||
return this.http | ||
.post(path, action.data, meta) | ||
.then((media) => { | ||
return this.waitForMediaAttachment(media.id); | ||
} | ||
return this.http.post(path, action.data, meta); | ||
}); | ||
} | ||
case "update": { | ||
return this.http.patch(path, action.data, meta); | ||
} | ||
case "remove": { | ||
return this.http.delete(path, action.data, meta); | ||
} | ||
case "list": { | ||
return new PaginatorHttp(this.http, path, action.data); | ||
} | ||
return this.http.post(path, action.data, meta); | ||
} | ||
}); | ||
case "update": { | ||
return this.http.patch(path, action.data, meta); | ||
} | ||
case "remove": { | ||
return this.http.delete(path, action.data, meta); | ||
} | ||
case "list": { | ||
return new PaginatorHttp(this.http, path, action.data); | ||
} | ||
} | ||
} | ||
@@ -318,0 +319,0 @@ isPrimitiveAction(action) { |
@@ -5,3 +5,3 @@ { | ||
"private": false, | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"author": "Ryo Igarashi <n33t5hin@gmail.com>", | ||
@@ -8,0 +8,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6487
265673