mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 19:35:16 +00:00
Clean up destroy routine
This commit is contained in:
28
frontend/src/api/accounts/destroy.js
vendored
28
frontend/src/api/accounts/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = '/api/v1/accounts/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
32
frontend/src/api/accounts/get.js
vendored
32
frontend/src/api/accounts/get.js
vendored
@@ -18,18 +18,34 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
import Api from "src/api/root/api";
|
||||||
|
|
||||||
export default class Get {
|
export default class Get extends Api {
|
||||||
|
constructor() {
|
||||||
|
super('accounts'); // call the super class constructor and pass in the name parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param identifier
|
||||||
|
* @param date
|
||||||
|
* @returns {Promise<AxiosResponse<any>>}
|
||||||
|
*/
|
||||||
get(identifier, date) {
|
get(identifier, date) {
|
||||||
let url = '/api/v1/accounts/' + identifier;
|
let params = {date: date};
|
||||||
if(!date) {
|
if(!date) {
|
||||||
return api.get(url);
|
return this.apiGet(identifier);
|
||||||
}
|
}
|
||||||
return api.get(url, {params: {date: date}});
|
return this.apiGet(identifier, params);
|
||||||
}
|
}
|
||||||
transactions(identifier, page, cacheKey) {
|
|
||||||
let url = '/api/v1/accounts/' + identifier + '/transactions';
|
/**
|
||||||
return api.get(url, {params: {page: page, cache: cacheKey}});
|
*
|
||||||
|
* @param identifier
|
||||||
|
* @param page
|
||||||
|
* @returns {Promise<AxiosResponse<any>>}
|
||||||
|
*/
|
||||||
|
transactions(identifier, page) {
|
||||||
|
return this.apiGetChildren('transactions', identifier, page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
frontend/src/api/accounts/list.js
vendored
19
frontend/src/api/accounts/list.js
vendored
@@ -19,10 +19,27 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
import {api} from "boot/axios";
|
||||||
|
import Api from "src/api/root/api";
|
||||||
|
|
||||||
|
export default class List extends Api{
|
||||||
|
constructor() {
|
||||||
|
super('accounts');
|
||||||
|
}
|
||||||
|
|
||||||
export default class List {
|
|
||||||
list(type, page, cacheKey) {
|
list(type, page, cacheKey) {
|
||||||
let url = '/api/v1/accounts';
|
let url = '/api/v1/accounts';
|
||||||
return api.get(url, {params: {page: page, cache: cacheKey, type: type}});
|
return api.get(url, {params: {page: page, cache: cacheKey, type: type}});
|
||||||
|
// console.log('list');
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// let params = {
|
||||||
|
// type: type,
|
||||||
|
// page: page
|
||||||
|
// }
|
||||||
|
// this.apiList(page, params).then((response) => {
|
||||||
|
// console.log('response OK');
|
||||||
|
// }).catch((err) => {
|
||||||
|
// console.error('api list failed');
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
frontend/src/api/budgets/destroy.js
vendored
28
frontend/src/api/budgets/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = 'api/v1/budgets/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
28
frontend/src/api/categories/destroy.js
vendored
28
frontend/src/api/categories/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = '/api/v1/categories/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
28
frontend/src/api/currencies/destroy.js
vendored
28
frontend/src/api/currencies/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = '/api/v1/currencies/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* post.js
|
* destroy.js
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
* Copyright (c) 2022 james@firefly-iii.org
|
||||||
*
|
*
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||||
@@ -18,11 +18,10 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
import Api from "src/api/root/api";
|
||||||
|
|
||||||
export default class Destroy {
|
export default class Destroy extends Api {
|
||||||
destroy(identifier) {
|
constructor(path) {
|
||||||
let url = '/api/v1/rules/' + identifier;
|
super(path);
|
||||||
return api.delete(url);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
28
frontend/src/api/groups/destroy.js
vendored
28
frontend/src/api/groups/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = '/api/v1/object_groups/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
28
frontend/src/api/piggy-banks/destroy.js
vendored
28
frontend/src/api/piggy-banks/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = '/api/v1/piggy_banks/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
28
frontend/src/api/recurring/destroy.js
vendored
28
frontend/src/api/recurring/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = '/api/v1/recurrences/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
104
frontend/src/api/root/api.js
vendored
Normal file
104
frontend/src/api/root/api.js
vendored
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
import {api} from "boot/axios";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export default class Api {
|
||||||
|
root = '/api/v1/';
|
||||||
|
path = '';
|
||||||
|
|
||||||
|
constructor(path) {
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiPath() {
|
||||||
|
return this.root + this.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiPathId(identifier) {
|
||||||
|
return this.root + this.path + '/' + identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param identifier
|
||||||
|
* @param params
|
||||||
|
* @returns {Promise<AxiosResponse<any>>}
|
||||||
|
*/
|
||||||
|
apiGet(identifier, params) {
|
||||||
|
let url = this.apiPathId(identifier);
|
||||||
|
if (params) {
|
||||||
|
return api.get(url, {params: params});
|
||||||
|
}
|
||||||
|
return api.get(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
destroy(identifier) {
|
||||||
|
let url = this.apiPathId(identifier);
|
||||||
|
return api.delete(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
apiPathChildren(identifier, type) {
|
||||||
|
return this.apiPathId(identifier) + '/' + type;
|
||||||
|
}
|
||||||
|
|
||||||
|
apiGetChildren(type, identifier, page) {
|
||||||
|
let url = this.apiPathChildren(identifier, type);
|
||||||
|
let cacheKey = 'still-todo';
|
||||||
|
// needs a cache key. Based on type.
|
||||||
|
return api.get(url, {params: {page: page, cache: cacheKey}});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param params
|
||||||
|
* @returns {Promise<AxiosResponse<any>>}
|
||||||
|
*/
|
||||||
|
apiList(page, params) {
|
||||||
|
let type = 'transactions';
|
||||||
|
let identifier = '1';
|
||||||
|
|
||||||
|
let cacheKey = 'still-todo';
|
||||||
|
let url = this.apiPathChildren(identifier, type);
|
||||||
|
|
||||||
|
// needs a cache key. Based on type.
|
||||||
|
return api.get(url, {params: {page: page, cache: cacheKey}});
|
||||||
|
|
||||||
|
|
||||||
|
// let identifier = 'abc';
|
||||||
|
// // test:
|
||||||
|
// let type= 'expense';
|
||||||
|
|
||||||
|
// let type ='accounts';
|
||||||
|
//
|
||||||
|
// this.store.getters["fireflyiii/getScopedCacheKey"](type);
|
||||||
|
// let cacheKey = 'def';
|
||||||
|
// let url = this.apiPath();
|
||||||
|
//
|
||||||
|
// // needs a cache key. Based on type.
|
||||||
|
// return api.get(url, {params: {page: page, cache: cacheKey}});
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// console.log('apiList');
|
||||||
|
// let cacheKey;
|
||||||
|
//
|
||||||
|
// //let $q = useQuasar();
|
||||||
|
// //const store = useStore();
|
||||||
|
// cacheKey = 'OK';
|
||||||
|
// console.log('path: ' + this.path);
|
||||||
|
// //cacheKey = $store.getters["fireflyiii/getScopedCacheKey"](this.path);
|
||||||
|
// //store.getters["fireflyiii/getScopedCacheKey"](this.path)
|
||||||
|
// let cache = {
|
||||||
|
// cache: cacheKey
|
||||||
|
// };
|
||||||
|
// let merged = {...params, ...cache};
|
||||||
|
// console.log(merged);
|
||||||
|
// let url = this.apiPath();
|
||||||
|
// console.log(url);
|
||||||
|
// return api.get(url, {params: merged});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
28
frontend/src/api/rule-groups/destroy.js
vendored
28
frontend/src/api/rule-groups/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = '/api/v1/rule_groups/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
28
frontend/src/api/subscriptions/destroy.js
vendored
28
frontend/src/api/subscriptions/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = '/api/v1/bills/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
28
frontend/src/api/transactions/destroy.js
vendored
28
frontend/src/api/transactions/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = '/api/v1/transactions/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
28
frontend/src/api/webhooks/destroy.js
vendored
28
frontend/src/api/webhooks/destroy.js
vendored
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* post.js
|
|
||||||
* Copyright (c) 2022 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {api} from "boot/axios";
|
|
||||||
|
|
||||||
export default class Destroy {
|
|
||||||
destroy(identifier) {
|
|
||||||
let url = '/api/v1/webhooks/' + identifier;
|
|
||||||
return api.delete(url);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -5,7 +5,6 @@
|
|||||||
:rows="rows"
|
:rows="rows"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
@request="onRequest"
|
|
||||||
v-model:pagination="pagination"
|
v-model:pagination="pagination"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
class="q-ma-md"
|
class="q-ma-md"
|
||||||
@@ -75,7 +74,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import {mapGetters, useStore} from "vuex";
|
import {mapGetters, useStore} from "vuex";
|
||||||
import List from "../../api/accounts/list";
|
import List from "../../api/accounts/list";
|
||||||
import Destroy from "../../api/accounts/destroy";
|
import Destroy from "../../api/generic/destroy";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
@@ -144,11 +143,12 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroyAccount: function (id) {
|
destroyAccount: function (id) {
|
||||||
let destr = new Destroy;
|
(new Destroy('accounts')).destroy(id).then(() => {
|
||||||
destr.destroy(id).then(() => {
|
this.rows= [];
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey').then(() => {
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
updateBreadcrumbs: function () {
|
updateBreadcrumbs: function () {
|
||||||
this.$route.meta.pageTitle = 'firefly.' + this.type + '_accounts';
|
this.$route.meta.pageTitle = 'firefly.' + this.type + '_accounts';
|
||||||
@@ -169,14 +169,15 @@ export default {
|
|||||||
return string.replace(NON_ALPHANUM, '').toUpperCase().replace(EVERY_FOUR_CHARS, "$1 ");
|
return string.replace(NON_ALPHANUM, '').toUpperCase().replace(EVERY_FOUR_CHARS, "$1 ");
|
||||||
},
|
},
|
||||||
triggerUpdate: function () {
|
triggerUpdate: function () {
|
||||||
if (this.loading) {
|
this.rows= [];
|
||||||
|
if (true === this.loading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (null === this.range.start || null === this.range.end) {
|
if (null === this.range.start || null === this.range.end) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const list = new List();
|
const list = new List;
|
||||||
this.rows = [];
|
this.rows = [];
|
||||||
list.list(this.type, this.page, this.getCacheKey).then(
|
list.list(this.type, this.page, this.getCacheKey).then(
|
||||||
(response) => {
|
(response) => {
|
||||||
@@ -198,8 +199,10 @@ export default {
|
|||||||
}
|
}
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
)
|
).catch((err) => {
|
||||||
;
|
console.error('Error loading list');
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -95,7 +95,7 @@ export default {
|
|||||||
const parser = new Parser;
|
const parser = new Parser;
|
||||||
this.rows = [];
|
this.rows = [];
|
||||||
|
|
||||||
get.transactions(this.id, this.page, this.getCacheKey).then(
|
get.transactions(this.id, this.page).then(
|
||||||
(response) => {
|
(response) => {
|
||||||
let resp = parser.parseResponse(response);
|
let resp = parser.parseResponse(response);
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters, useStore} from "vuex";
|
import {mapGetters, useStore} from "vuex";
|
||||||
import Destroy from "../../api/budgets/destroy";
|
import Destroy from "../../api/generic/destroy";
|
||||||
import List from "../../api/budgets/list";
|
import List from "../../api/budgets/list";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -135,8 +135,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroyBudget: function (id) {
|
destroyBudget: function (id) {
|
||||||
let destr = new Destroy;
|
(new Destroy('budgets')).destroy(id).then(() => {
|
||||||
destr.destroy(id).then(() => {
|
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
|
@@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters, useStore} from "vuex";
|
import {mapGetters, useStore} from "vuex";
|
||||||
import Destroy from "../../api/categories/destroy";
|
import Destroy from "../../api/generic/destroy";
|
||||||
import List from "../../api/categories/list";
|
import List from "../../api/categories/list";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -135,8 +135,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroyCategory: function (id) {
|
destroyCategory: function (id) {
|
||||||
let destr = new Destroy;
|
(new Destroy('categories')).destroy(id).then(() => {
|
||||||
destr.destroy(id).then(() => {
|
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
|
@@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters, useStore} from "vuex";
|
import {mapGetters, useStore} from "vuex";
|
||||||
import Destroy from "../../api/currencies/destroy";
|
import Destroy from "../../api/generic/destroy";
|
||||||
import List from "../../api/currencies/list";
|
import List from "../../api/currencies/list";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -137,8 +137,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroyCurrency: function (code) {
|
destroyCurrency: function (code) {
|
||||||
let destr = new Destroy;
|
(new Destroy('currencies')).destroy(code).then(() => {
|
||||||
destr.destroy(code).then(() => {
|
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
|
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters, useStore} from "vuex";
|
import {mapGetters, useStore} from "vuex";
|
||||||
import Destroy from "../../api/groups/destroy";
|
import Destroy from "../../api/generic/destroy";
|
||||||
import List from "../../api/groups/list";
|
import List from "../../api/groups/list";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -119,9 +119,8 @@ export default {
|
|||||||
// TODO needs error catch.
|
// TODO needs error catch.
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroyGroup: function (code) {
|
destroyGroup: function (identifier) {
|
||||||
let destr = new Destroy;
|
(new Destroy('object_groups')).destroy(identifier).then(() => {
|
||||||
destr.destroy(code).then(() => {
|
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
|
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters, useStore} from "vuex";
|
import {mapGetters, useStore} from "vuex";
|
||||||
import Destroy from "../../api/piggy-banks/destroy";
|
import Destroy from "../../api/generic/destroy";
|
||||||
import List from "../../api/piggy-banks/list";
|
import List from "../../api/piggy-banks/list";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -131,8 +131,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroyPiggyBank: function (id) {
|
destroyPiggyBank: function (id) {
|
||||||
let destr = new Destroy;
|
(new Destroy('piggy_banks')).destroy(id).then(() => {
|
||||||
destr.destroy(id).then(() => {
|
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
|
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters, useStore} from "vuex";
|
import {mapGetters, useStore} from "vuex";
|
||||||
import Destroy from "../../api/recurring/destroy";
|
import Destroy from "../../api/generic/destroy";
|
||||||
import List from "../../api/recurring/list";
|
import List from "../../api/recurring/list";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -132,8 +132,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroyRecurring: function (id) {
|
destroyRecurring: function (id) {
|
||||||
let destr = new Destroy;
|
(new Destroy('recurrences')).destroy(id).then(() => {
|
||||||
destr.destroy(id).then(() => {
|
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
|
@@ -80,8 +80,7 @@
|
|||||||
import {mapGetters} from "vuex";
|
import {mapGetters} from "vuex";
|
||||||
import List from "../../api/rule-groups/list";
|
import List from "../../api/rule-groups/list";
|
||||||
import Get from "../../api/rule-groups/get";
|
import Get from "../../api/rule-groups/get";
|
||||||
import Destroy from "../../api/rule-groups/destroy";
|
import Destroy from "../../api/generic/destroy";
|
||||||
import DestroyRule from "../../api/rules/destroy";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
@@ -142,15 +141,13 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroyRuleGroup: function (id) {
|
destroyRuleGroup: function (id) {
|
||||||
let destr = new Destroy;
|
(new Destroy('rule_groups')).destroy(id).then(() => {
|
||||||
destr.destroy(id).then(() => {
|
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroyRule: function (id) {
|
destroyRule: function (id) {
|
||||||
let destr = new DestroyRule;
|
(new Destroy('rules')).destroy(id).then(() => {
|
||||||
destr.destroy(id).then(() => {
|
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
|
@@ -67,7 +67,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import {mapGetters, useStore} from "vuex";
|
import {mapGetters, useStore} from "vuex";
|
||||||
import List from "../../api/subscriptions/list";
|
import List from "../../api/subscriptions/list";
|
||||||
import Destroy from "../../api/subscriptions/destroy";
|
import Destroy from "../../api/generic/destroy";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
@@ -127,8 +127,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroySubscription: function (id) {
|
destroySubscription: function (id) {
|
||||||
let destr = new Destroy;
|
(new Destroy('bills')).destroy(id).then(() => {
|
||||||
destr.destroy(id).then(() => {
|
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
|
@@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters} from "vuex";
|
import {mapGetters} from "vuex";
|
||||||
import Destroy from "../../api/webhooks/destroy";
|
import Destroy from "../../api/generic/destroy";
|
||||||
import List from "../../api/webhooks/list";
|
import List from "../../api/webhooks/list";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -119,8 +119,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
destroyWebhook: function (id) {
|
destroyWebhook: function (id) {
|
||||||
let destr = new Destroy;
|
(new Destroy('webhooks')).destroy(id).then(() => {
|
||||||
destr.destroy(id).then(() => {
|
|
||||||
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
this.$store.dispatch('fireflyiii/refreshCacheKey');
|
||||||
this.triggerUpdate();
|
this.triggerUpdate();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user