release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
1 changed files with 10 additions and 3 deletions
Showing only changes of commit bda5602e9f - Show all commits

View File

@ -1,5 +1,5 @@
import { Module, MutationTree, ActionTree, GetterTree } from 'vuex'; import { Module, MutationTree, ActionTree, GetterTree } from 'vuex';
import { StateInterface } from 'src/store'; import store, { StateInterface } from 'src/store';
import { axios } from 'src/boot/axios'; import { axios } from 'src/boot/axios';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
@ -170,13 +170,20 @@ const actions: ActionTree<BalanceInterface, StateInterface> = {
dispatch('getBalance').catch(err => console.warn(err)); dispatch('getBalance').catch(err => console.warn(err));
}); });
}, },
changeBalance({ dispatch, commit }, data: { amount: number; user: string; sender?: string }) { changeBalance(
{ dispatch, commit, rootState },
data: { amount: number; user: string; sender?: string }
) {
commit('setLoading'); commit('setLoading');
return axios return axios
.put(`/users/${data.user}/balance`, data) .put(`/users/${data.user}/balance`, data)
.then((response: AxiosResponse<FG.Transaction>) => { .then((response: AxiosResponse<FG.Transaction>) => {
const transaction = response.data; const transaction = response.data;
fixTransaction(transaction); fixTransaction(transaction);
if (
data.user == rootState.user.currentUser?.userid ||
data.sender === rootState.user.currentUser?.userid
)
commit('addTransaction', transaction); commit('addTransaction', transaction);
commit(state.balances.has(data.user) ? 'changeBalance' : 'setBalance', { commit(state.balances.has(data.user) ? 'changeBalance' : 'setBalance', {
userid: data.user, userid: data.user,