summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/jira_connect/subscriptions/api.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/jira_connect/subscriptions/api.js')
-rw-r--r--app/assets/javascripts/jira_connect/subscriptions/api.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/app/assets/javascripts/jira_connect/subscriptions/api.js b/app/assets/javascripts/jira_connect/subscriptions/api.js
new file mode 100644
index 00000000000..14947b6c835
--- /dev/null
+++ b/app/assets/javascripts/jira_connect/subscriptions/api.js
@@ -0,0 +1,31 @@
+import axios from 'axios';
+import { getJwt } from './utils';
+
+export const addSubscription = async (addPath, namespace) => {
+ const jwt = await getJwt();
+
+ return axios.post(addPath, {
+ jwt,
+ namespace_path: namespace,
+ });
+};
+
+export const removeSubscription = async (removePath) => {
+ const jwt = await getJwt();
+
+ return axios.delete(removePath, {
+ params: {
+ jwt,
+ },
+ });
+};
+
+export const fetchGroups = async (groupsPath, { page, perPage, search }) => {
+ return axios.get(groupsPath, {
+ params: {
+ page,
+ per_page: perPage,
+ search,
+ },
+ });
+};