From f1658a06d1635e59c68f92080ce2c11f64325810 Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Fri, 1 Oct 2021 00:01:32 +0530
Subject: [PATCH 01/13] confirmation added for workspace
---
src/components/workspace/settings/Layout.vue | 28 +++++++++++++-------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/components/workspace/settings/Layout.vue b/src/components/workspace/settings/Layout.vue
index 5e3374e34..0a2f46cca 100644
--- a/src/components/workspace/settings/Layout.vue
+++ b/src/components/workspace/settings/Layout.vue
@@ -70,6 +70,7 @@ import EntityImage from '../../utils/EntityImage.vue';
import SettingsWindow from '../../settings/Window.vue';
import Icon from '../../utils/Icon.vue';
import { FETCH_WORKSPACE, LEAVE_WORKSPACE } from '@/store/modules/workspaces/actionTypes';
+import { ActionType } from '../../utils/ConfirmationWindow/types';
// eslint-disable-next-line no-unused-vars
import { Workspace } from '@/types/workspaces';
import notifier from 'codex-notifier';
@@ -137,16 +138,23 @@ export default Vue.extend({
* Leave current workspace
*/
async leaveWorkspace() {
- try {
- await this.$store.dispatch(LEAVE_WORKSPACE, this.workspace!.id);
- this.$router.push({ name: 'home' });
- } catch (e) {
- notifier.show({
- message: this.$i18n.t('workspaces.settings.leaveError').toString(),
- style: 'error',
- time: 10000,
- });
- }
+ this.$confirm.open({
+ description: this.$i18n.t('projects.settings.removeConfirmation').toString(),
+ actionType: ActionType.DELETION,
+ continueButtonText: this.$i18n.t('projects.settings.remove').toString(),
+ onConfirm: async () => {
+ try {
+ await this.$store.dispatch(LEAVE_WORKSPACE, this.workspace!.id);
+ this.$router.push({ name: 'home' });
+ } catch (e) {
+ notifier.show({
+ message: this.$i18n.t('workspaces.settings.leaveError').toString(),
+ style: 'error',
+ time: 10000,
+ });
+ }
+ },
+ });
},
},
});
From 34df645e0e5b1459aa5a444b1c10a3e0bb2ccf32 Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Fri, 1 Oct 2021 00:09:25 +0530
Subject: [PATCH 02/13] i18n added
---
src/components/workspace/settings/Layout.vue | 4 ++--
src/i18n/messages/en.json | 2 ++
src/i18n/messages/ru.json | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/components/workspace/settings/Layout.vue b/src/components/workspace/settings/Layout.vue
index 0a2f46cca..da6403970 100644
--- a/src/components/workspace/settings/Layout.vue
+++ b/src/components/workspace/settings/Layout.vue
@@ -139,9 +139,9 @@ export default Vue.extend({
*/
async leaveWorkspace() {
this.$confirm.open({
- description: this.$i18n.t('projects.settings.removeConfirmation').toString(),
+ description: this.$i18n.t('workspaces.settings.removeConfirmation').toString(),
actionType: ActionType.DELETION,
- continueButtonText: this.$i18n.t('projects.settings.remove').toString(),
+ continueButtonText: this.$i18n.t('workspaces.settings.remove').toString(),
onConfirm: async () => {
try {
await this.$store.dispatch(LEAVE_WORKSPACE, this.workspace!.id);
diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json
index e88f8f61f..c994df341 100644
--- a/src/i18n/messages/en.json
+++ b/src/i18n/messages/en.json
@@ -234,6 +234,8 @@
"label": "Workspace settings",
"leave": "Leave workspace",
"leaveError": "You can't leave this workspace because you are the last admin",
+ "removeConfirmation": "Are you sure you want to delete this workspace?",
+ "remove": "Remove workspace",
"workspace": {
"title": "Workspace settings",
"name": "Name",
diff --git a/src/i18n/messages/ru.json b/src/i18n/messages/ru.json
index 171a0abf4..894de19cf 100644
--- a/src/i18n/messages/ru.json
+++ b/src/i18n/messages/ru.json
@@ -234,6 +234,8 @@
"label": "Настройка воркспейса",
"leave": "Покинуть воркспейс",
"leaveError": "Вы не можете покинуть воркспейс, так как вы последний администратор",
+ "remove": "Удалить воркспейс",
+ "removeConfirmation": "Вы точно хотите удалить этот воркспейс?",
"workspace": {
"title": "Настройки воркспейса",
"name": "Название",
From 192060f63aad01dc489017ee5c742bb273751ebc Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Tue, 26 Oct 2021 05:57:54 +0530
Subject: [PATCH 03/13] delete worksapce added
---
src/components/workspace/settings/Layout.vue | 106 +++++++++++--------
1 file changed, 59 insertions(+), 47 deletions(-)
diff --git a/src/components/workspace/settings/Layout.vue b/src/components/workspace/settings/Layout.vue
index da6403970..e3d7c6fba 100644
--- a/src/components/workspace/settings/Layout.vue
+++ b/src/components/workspace/settings/Layout.vue
@@ -23,33 +23,43 @@
-
+
@@ -69,7 +79,7 @@ import Vue from 'vue';
import EntityImage from '../../utils/EntityImage.vue';
import SettingsWindow from '../../settings/Window.vue';
import Icon from '../../utils/Icon.vue';
-import { FETCH_WORKSPACE, LEAVE_WORKSPACE } from '@/store/modules/workspaces/actionTypes';
+import { FETCH_WORKSPACE, LEAVE_WORKSPACE, DELETE_WORKSPACE } from '@/store/modules/workspaces/actionTypes';
import { ActionType } from '../../utils/ConfirmationWindow/types';
// eslint-disable-next-line no-unused-vars
import { Workspace } from '@/types/workspaces';
@@ -138,21 +148,23 @@ export default Vue.extend({
* Leave current workspace
*/
async leaveWorkspace() {
+ try {
+ await this.$store.dispatch(LEAVE_WORKSPACE, this.workspace!.id);
+ this.$router.push({ name: 'home' });
+ } catch (e) {
+ notifier.show({
+ message: this.$i18n.t('workspaces.settings.leaveError').toString(),
+ style: 'error',
+ time: 10000,
+ });
+ }
this.$confirm.open({
description: this.$i18n.t('workspaces.settings.removeConfirmation').toString(),
actionType: ActionType.DELETION,
continueButtonText: this.$i18n.t('workspaces.settings.remove').toString(),
onConfirm: async () => {
- try {
- await this.$store.dispatch(LEAVE_WORKSPACE, this.workspace!.id);
- this.$router.push({ name: 'home' });
- } catch (e) {
- notifier.show({
- message: this.$i18n.t('workspaces.settings.leaveError').toString(),
- style: 'error',
- time: 10000,
- });
- }
+ await this.$store.dispatch(DELETE_WORKSPACE, this.workspace!.id);
+ this.$router.push({ name: 'home' });
},
});
},
@@ -161,32 +173,32 @@ export default Vue.extend({
From e38f71d8fee68e7118c4784004f2fa6467201059 Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Tue, 26 Oct 2021 05:58:25 +0530
Subject: [PATCH 04/13] delete workspace api added
---
src/api/workspaces/index.ts | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/api/workspaces/index.ts b/src/api/workspaces/index.ts
index af47ef749..9af3fc73b 100644
--- a/src/api/workspaces/index.ts
+++ b/src/api/workspaces/index.ts
@@ -2,6 +2,7 @@ import {
MUTATION_CONFIRM_INVITE,
MUTATION_CREATE_WORKSPACE,
MUTATION_LEAVE_WORKSPACE,
+ MUTATION_DELETE_WORKSPACE,
MUTATION_GRANT_ADMIN_PERMISSIONS,
MUTATION_INVITE_TO_WORKSPACE,
MUTATION_REMOVE_MEMBER_FROM_WORKSPACE,
@@ -34,7 +35,7 @@ interface CreateWorkspaceInput {
* @param {Workspace} workspaceInfo - workspace to create
* @returns {Promise} created workspace
*/
-export async function createWorkspace(workspaceInfo: CreateWorkspaceInput): Promise> {
+export async function createWorkspace(workspaceInfo: CreateWorkspaceInput): Promise> {
const { image, ...rest } = workspaceInfo;
return await api.call(MUTATION_CREATE_WORKSPACE, rest, { image });
@@ -49,6 +50,15 @@ export async function leaveWorkspace(workspaceId: string): Promise {
return (await api.callOld(MUTATION_LEAVE_WORKSPACE, { workspaceId })).leaveWorkspace;
}
+/**
+ * Leave workspace
+ *
+ * @param {string} workspaceId - id of workspace to delete
+ */
+export async function deleteWorkspace(workspaceId: string): Promise {
+ return (await api.callOld(MUTATION_DELETE_WORKSPACE, { workspaceId })).deleteWorkspace;
+}
+
/**
* Returns all user's workspaces and project.
*
From 1663f114e1775153be77fcad8f14bb0cca4b0baa Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Tue, 26 Oct 2021 05:59:00 +0530
Subject: [PATCH 05/13] delete workspace mutation added
---
src/api/workspaces/queries.ts | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/api/workspaces/queries.ts b/src/api/workspaces/queries.ts
index fa6e79adf..314503668 100644
--- a/src/api/workspaces/queries.ts
+++ b/src/api/workspaces/queries.ts
@@ -113,6 +113,19 @@ export const MUTATION_LEAVE_WORKSPACE = `
}
`;
+
+// language=GraphQL
+/**
+ * Mutation to delete workspace
+ */
+export const MUTATION_DELETE_WORKSPACE = `
+ mutation leaveWorkspace(
+ $workspaceId: ID!
+ ) {
+ deleteWorkspace(workspaceId: $workspaceId)
+ }
+`;
+
// language=GraphQL
/**
* Mutation to join to workspace by invite link
From 0942630588c598799106e11823b30dadbc820cd6 Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Tue, 26 Oct 2021 05:59:50 +0530
Subject: [PATCH 06/13] veux updated for delete workspace
---
src/store/modules/workspaces/actionTypes.js | 5 +++++
src/store/modules/workspaces/index.js | 25 +++++++++++++++++----
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/store/modules/workspaces/actionTypes.js b/src/store/modules/workspaces/actionTypes.js
index 89e9eabc7..966d247fc 100644
--- a/src/store/modules/workspaces/actionTypes.js
+++ b/src/store/modules/workspaces/actionTypes.js
@@ -18,6 +18,11 @@ export const CREATE_WORKSPACE = 'CREATE_WORKSPACE';
*/
export const LEAVE_WORKSPACE = 'LEAVE_WORKSPACE';
+/**
+ * Delete current workspace
+ */
+export const DELETE_WORKSPACE = 'DELETE_WORKSPACE';
+
/**
* Send request to invite user to workspace
*/
diff --git a/src/store/modules/workspaces/index.js b/src/store/modules/workspaces/index.js
index fa308ab91..9f35ac7bd 100644
--- a/src/store/modules/workspaces/index.js
+++ b/src/store/modules/workspaces/index.js
@@ -2,6 +2,7 @@ import {
CREATE_WORKSPACE,
SET_WORKSPACES_LIST,
LEAVE_WORKSPACE,
+ DELETE_WORKSPACE,
SET_CURRENT_WORKSPACE,
INVITE_TO_WORKSPACE,
CONFIRM_INVITE,
@@ -148,7 +149,7 @@ const actions = {
},
/**
- * Send request to delete workspace
+ * Send request to leave workspace
*
* @param {object} context - vuex action context
* @param {Function} context.commit - standard Vuex commit function
@@ -163,6 +164,22 @@ const actions = {
commit(mutationTypes.REMOVE_WORKSPACE, workspaceId);
},
+ /**
+ * Send request to delete workspace
+ *
+ * @param {object} context - vuex action context
+ * @param {Function} context.commit - standard Vuex commit function
+ * @param {Function} context.dispatch - standard Vuex dispatch function
+ * @param {string} workspaceId - id of workspace for deleting
+ */
+ async [DELETE_WORKSPACE]({ commit, dispatch }, workspaceId) {
+ await workspaceApi.deleteWorkspace(workspaceId);
+
+ dispatch(REMOVE_PROJECTS_BY_WORKSPACE_ID, workspaceId);
+ commit(mutationTypes.SET_CURRENT_WORKSPACE, null);
+ commit(mutationTypes.REMOVE_WORKSPACE, workspaceId);
+ },
+
/**
* Sent request to invite user to workspace
*
@@ -242,7 +259,7 @@ const actions = {
* @returns {Promise}
*/
async [FETCH_WORKSPACE]({ commit }, id) {
- const workspace = (await workspaceApi.getWorkspaces([ id ]))[0];
+ const workspace = (await workspaceApi.getWorkspaces([id]))[0];
if (!workspace) {
throw new Error('The workspace was not found');
@@ -520,10 +537,10 @@ const mutations = {
[mutationTypes.UPDATE_BUSINESS_OPERATIONS](state, { workspaceId, businessOperation }) {
const index = state.list.findIndex(w => w.id === workspaceId);
const workspace = state.list[index];
- let updatedPaymentsHistory = [ businessOperation ];
+ let updatedPaymentsHistory = [businessOperation];
if (workspace.paymentsHistory) {
- updatedPaymentsHistory = [ businessOperation ].concat(workspace.paymentsHistory);
+ updatedPaymentsHistory = [businessOperation].concat(workspace.paymentsHistory);
}
Vue.set(workspace, 'paymentsHistory', updatedPaymentsHistory);
From 5487fa61f067143dc403c5660402e9d35be9afb2 Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Thu, 4 Nov 2021 20:02:16 +0530
Subject: [PATCH 07/13] bugfix: confirmation box placed properly
---
src/components/workspace/settings/Layout.vue | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/components/workspace/settings/Layout.vue b/src/components/workspace/settings/Layout.vue
index e3d7c6fba..487273639 100644
--- a/src/components/workspace/settings/Layout.vue
+++ b/src/components/workspace/settings/Layout.vue
@@ -157,16 +157,16 @@ export default Vue.extend({
style: 'error',
time: 10000,
});
+ this.$confirm.open({
+ description: this.$i18n.t('workspaces.settings.removeConfirmation').toString(),
+ actionType: ActionType.DELETION,
+ continueButtonText: this.$i18n.t('workspaces.settings.remove').toString(),
+ onConfirm: async () => {
+ await this.$store.dispatch(DELETE_WORKSPACE, this.workspace!.id);
+ this.$router.push({ name: 'home' });
+ },
+ });
}
- this.$confirm.open({
- description: this.$i18n.t('workspaces.settings.removeConfirmation').toString(),
- actionType: ActionType.DELETION,
- continueButtonText: this.$i18n.t('workspaces.settings.remove').toString(),
- onConfirm: async () => {
- await this.$store.dispatch(DELETE_WORKSPACE, this.workspace!.id);
- this.$router.push({ name: 'home' });
- },
- });
},
},
});
From b70398fffd4cda455c6aeea2f59fbe71cf53c450 Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Wed, 17 Nov 2021 22:34:19 +0530
Subject: [PATCH 08/13] remove the notifier
---
src/components/workspace/settings/Layout.vue | 5 -----
1 file changed, 5 deletions(-)
diff --git a/src/components/workspace/settings/Layout.vue b/src/components/workspace/settings/Layout.vue
index 487273639..f9d19c984 100644
--- a/src/components/workspace/settings/Layout.vue
+++ b/src/components/workspace/settings/Layout.vue
@@ -152,11 +152,6 @@ export default Vue.extend({
await this.$store.dispatch(LEAVE_WORKSPACE, this.workspace!.id);
this.$router.push({ name: 'home' });
} catch (e) {
- notifier.show({
- message: this.$i18n.t('workspaces.settings.leaveError').toString(),
- style: 'error',
- time: 10000,
- });
this.$confirm.open({
description: this.$i18n.t('workspaces.settings.removeConfirmation').toString(),
actionType: ActionType.DELETION,
From aa8d5e507d3938521e688cd1f595a4015b47deb5 Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Wed, 17 Nov 2021 23:08:57 +0530
Subject: [PATCH 09/13] callOld => call
---
src/api/workspaces/index.ts | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/api/workspaces/index.ts b/src/api/workspaces/index.ts
index 9af3fc73b..97547f72a 100644
--- a/src/api/workspaces/index.ts
+++ b/src/api/workspaces/index.ts
@@ -16,6 +16,7 @@ import {
import * as api from '../index';
import { Workspace } from '@/types/workspaces';
import { APIResponse, APIResponseData } from '@/types/api';
+import { data } from 'cypress/types/jquery';
interface CreateWorkspaceInput {
/**
@@ -56,7 +57,7 @@ export async function leaveWorkspace(workspaceId: string): Promise {
* @param {string} workspaceId - id of workspace to delete
*/
export async function deleteWorkspace(workspaceId: string): Promise {
- return (await api.callOld(MUTATION_DELETE_WORKSPACE, { workspaceId })).deleteWorkspace;
+ return (await api.call(MUTATION_DELETE_WORKSPACE, { workspaceId })).data.deleteWorkspace;
}
/**
From c0739a9fbb35a4e07b74bd590f2aa1f82576da3f Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Wed, 17 Nov 2021 23:11:24 +0530
Subject: [PATCH 10/13] remove unused import
---
src/api/workspaces/index.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/api/workspaces/index.ts b/src/api/workspaces/index.ts
index 97547f72a..c6f1745bc 100644
--- a/src/api/workspaces/index.ts
+++ b/src/api/workspaces/index.ts
@@ -16,7 +16,6 @@ import {
import * as api from '../index';
import { Workspace } from '@/types/workspaces';
import { APIResponse, APIResponseData } from '@/types/api';
-import { data } from 'cypress/types/jquery';
interface CreateWorkspaceInput {
/**
From c0643910b35f2ca0eac28de32f4889cd8f8be2d8 Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Wed, 19 Jan 2022 22:58:23 +0530
Subject: [PATCH 11/13] check for the last admin added
---
src/components/workspace/settings/Layout.vue | 27 ++++++++++++--------
src/store/modules/workspaces/index.js | 6 +++--
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/components/workspace/settings/Layout.vue b/src/components/workspace/settings/Layout.vue
index f9d19c984..8ada6c0e9 100644
--- a/src/components/workspace/settings/Layout.vue
+++ b/src/components/workspace/settings/Layout.vue
@@ -149,18 +149,25 @@ export default Vue.extend({
*/
async leaveWorkspace() {
try {
- await this.$store.dispatch(LEAVE_WORKSPACE, this.workspace!.id);
- this.$router.push({ name: 'home' });
+ const isThereOtherAdmins = await this.$store.dispatch(LEAVE_WORKSPACE, this.workspace!.id);
+
+ if (!isThereOtherAdmins) {
+ this.$confirm.open({
+ description: this.$i18n.t('workspaces.settings.removeConfirmation').toString(),
+ actionType: ActionType.DELETION,
+ continueButtonText: this.$i18n.t('workspaces.settings.remove').toString(),
+ onConfirm: async () => {
+ await this.$store.dispatch(DELETE_WORKSPACE, this.workspace!.id);
+ },
+ });
+ }
} catch (e) {
- this.$confirm.open({
- description: this.$i18n.t('workspaces.settings.removeConfirmation').toString(),
- actionType: ActionType.DELETION,
- continueButtonText: this.$i18n.t('workspaces.settings.remove').toString(),
- onConfirm: async () => {
- await this.$store.dispatch(DELETE_WORKSPACE, this.workspace!.id);
- this.$router.push({ name: 'home' });
- },
+ notifier.show({
+ message: this.$i18n.t(`workspaces.errors.${e.message}`) as string,
+ style: 'error',
+ time: 5000,
});
+ await this.$router.push({ name: 'home' });
}
},
},
diff --git a/src/store/modules/workspaces/index.js b/src/store/modules/workspaces/index.js
index 9f35ac7bd..a5f1a8a86 100644
--- a/src/store/modules/workspaces/index.js
+++ b/src/store/modules/workspaces/index.js
@@ -157,8 +157,10 @@ const actions = {
* @param {string} workspaceId - id of workspace for deleting
*/
async [LEAVE_WORKSPACE]({ commit, dispatch }, workspaceId) {
- await workspaceApi.leaveWorkspace(workspaceId);
-
+ const success = await workspaceApi.leaveWorkspace(workspaceId);
+ if (!success) {
+ return false;
+ }
dispatch(REMOVE_PROJECTS_BY_WORKSPACE_ID, workspaceId);
commit(mutationTypes.SET_CURRENT_WORKSPACE, null);
commit(mutationTypes.REMOVE_WORKSPACE, workspaceId);
From 8c4232f2ac1144c5022f5fee3a30630b1ffc167b Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Wed, 16 Feb 2022 21:09:50 +0530
Subject: [PATCH 12/13] Update src/i18n/messages/ru.json
Co-authored-by: Taly
---
src/i18n/messages/ru.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/i18n/messages/ru.json b/src/i18n/messages/ru.json
index f5cd0cf0a..49ecb228a 100644
--- a/src/i18n/messages/ru.json
+++ b/src/i18n/messages/ru.json
@@ -234,8 +234,8 @@
"label": "Настройка воркспейса",
"leave": "Покинуть воркспейс",
"leaveError": "Вы не можете покинуть воркспейс, так как вы последний администратор",
- "remove": "Удалить воркспейс",
"removeConfirmation": "Вы точно хотите удалить этот воркспейс?",
+ "remove": "Удалить воркспейс",
"workspace": {
"title": "Настройки воркспейса",
"name": "Название",
From ddef96f1fafcf6d1397a2f39bef127a8331012fc Mon Sep 17 00:00:00 2001
From: "Umang G. Patel" <23169768+robonetphy@users.noreply.github.com>
Date: Fri, 18 Feb 2022 22:50:35 +0530
Subject: [PATCH 13/13] the poper return type added
---
src/api/workspaces/index.ts | 5 +++--
src/api/workspaces/queries.ts | 2 +-
src/store/modules/workspaces/index.js | 2 ++
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/api/workspaces/index.ts b/src/api/workspaces/index.ts
index 200136c70..97fe37f95 100644
--- a/src/api/workspaces/index.ts
+++ b/src/api/workspaces/index.ts
@@ -55,8 +55,9 @@ export async function leaveWorkspace(workspaceId: string): Promise {
*
* @param {string} workspaceId - id of workspace to delete
*/
-export async function deleteWorkspace(workspaceId: string): Promise {
- return (await api.call(MUTATION_DELETE_WORKSPACE, { workspaceId })).data.deleteWorkspace;
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export async function deleteWorkspace(workspaceId: string): Promise> {
+ return await api.call(MUTATION_DELETE_WORKSPACE, { workspaceId });
}
/**
diff --git a/src/api/workspaces/queries.ts b/src/api/workspaces/queries.ts
index fa3b9035b..57e62e032 100644
--- a/src/api/workspaces/queries.ts
+++ b/src/api/workspaces/queries.ts
@@ -119,7 +119,7 @@ export const MUTATION_LEAVE_WORKSPACE = `
* Mutation to delete workspace
*/
export const MUTATION_DELETE_WORKSPACE = `
- mutation leaveWorkspace(
+ mutation deleteWorkspace(
$workspaceId: ID!
) {
deleteWorkspace(workspaceId: $workspaceId)
diff --git a/src/store/modules/workspaces/index.js b/src/store/modules/workspaces/index.js
index a5f1a8a86..63411465f 100644
--- a/src/store/modules/workspaces/index.js
+++ b/src/store/modules/workspaces/index.js
@@ -155,9 +155,11 @@ const actions = {
* @param {Function} context.commit - standard Vuex commit function
* @param {Function} context.dispatch - standard Vuex dispatch function
* @param {string} workspaceId - id of workspace for deleting
+ * @returns {boolean} - check if is there other admins are there.
*/
async [LEAVE_WORKSPACE]({ commit, dispatch }, workspaceId) {
const success = await workspaceApi.leaveWorkspace(workspaceId);
+
if (!success) {
return false;
}