From 9b038e4fdf4f78883c7a04ff905d3ff81f06ba3b Mon Sep 17 00:00:00 2001 From: FredericEspiau Date: Thu, 25 Jul 2019 15:36:26 +0200 Subject: [PATCH] fix(support): add interceptor for POST calls --- src/support/support.v6.service.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/support/support.v6.service.js b/src/support/support.v6.service.js index a95154e6..c77dfce5 100644 --- a/src/support/support.v6.service.js +++ b/src/support/support.v6.service.js @@ -5,6 +5,14 @@ angular.module("ovh-api-services").service("OvhApiSupportV6", function ($resourc var cache = $cacheFactory("OvhApiSupportV6"); var queryCache = $cacheFactory("OvhApiSupportV6Query"); + var interceptor = { + response: function (response) { + cache.removeAll(); + queryCache.removeAll(); + return response; + } + }; + var support = $resource("/support/tickets/:id", { id: "@id" }, { @@ -17,19 +25,23 @@ angular.module("ovh-api-services").service("OvhApiSupportV6", function ($resourc isArray: true }, create: { + interceptor: interceptor, method: "POST", url: "/support/tickets/:id/create" }, close: { hasBody: false, + interceptor: interceptor, method: "POST", url: "/support/tickets/:id/close" }, reopen: { + interceptor: interceptor, method: "POST", url: "/support/tickets/:id/reopen" }, reply: { + interceptor: interceptor, method: "POST", url: "/support/tickets/:id/reply" }