Merge branch 'develop' into negue/modal-notifications
This commit is contained in:
@@ -46,6 +46,15 @@ export async function login (store, params) {
|
||||
localStorage.setItem(LOCALSTORAGE_AUTH_KEY, userLocalData);
|
||||
}
|
||||
|
||||
export async function verifyUsername (store, params) {
|
||||
let url = '/api/v4/user/auth/verify-username';
|
||||
let result = await axios.post(url, {
|
||||
username: params.username,
|
||||
});
|
||||
|
||||
return result.data.data;
|
||||
}
|
||||
|
||||
export async function socialAuth (store, params) {
|
||||
let url = '/api/v4/user/auth/social';
|
||||
let result = await axios.post(url, {
|
||||
|
||||
@@ -84,8 +84,10 @@ export async function updateChallenge (store, payload) {
|
||||
}
|
||||
|
||||
export async function deleteChallenge (store, payload) {
|
||||
let response = await axios.delete(`/api/v4/challenges/${payload.challengeId}`);
|
||||
|
||||
const response = await axios.delete(`/api/v4/challenges/${payload.challengeId}`);
|
||||
if (payload.prize) {
|
||||
store.state.user.data.balance += payload.prize / 4;
|
||||
}
|
||||
return response.data.data;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,16 +6,17 @@ import * as Analytics from 'client/libs/analytics';
|
||||
|
||||
export async function sendAction (store, payload) {
|
||||
// @TODO: Maybe move this to server
|
||||
let partyData = {
|
||||
partyID: store.state.user.data.party._id,
|
||||
partySize: store.state.partyMembers.data.length,
|
||||
};
|
||||
|
||||
let partyData = {};
|
||||
if (store.state.party && store.state.party.data) {
|
||||
partyData = {
|
||||
partyID: store.state.party.data._id,
|
||||
partySize: store.state.party.data.memberCount,
|
||||
};
|
||||
} else {
|
||||
partyData = {
|
||||
partyID: store.state.user.data.party._id,
|
||||
partySize: store.state.partyMembers.data.length,
|
||||
};
|
||||
}
|
||||
|
||||
Analytics.updateUser(partyData);
|
||||
|
||||
@@ -19,13 +19,13 @@ export function fetchUserTasks (store, options = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchCompletedTodos (store, forceLoad = false) {
|
||||
export async function fetchCompletedTodos (store) {
|
||||
// Wait for the user to be loaded before deserializing
|
||||
// because user.tasksOrder is necessary
|
||||
await store.dispatch('tasks:fetchUserTasks');
|
||||
|
||||
const loadStatus = store.state.completedTodosStatus;
|
||||
if (loadStatus === 'NOT_LOADED' || forceLoad) {
|
||||
if (loadStatus !== 'LOADING') {
|
||||
store.state.completedTodosStatus = 'LOADING';
|
||||
|
||||
const response = await axios.get('/api/v4/tasks/user?type=completedTodos');
|
||||
@@ -36,17 +36,6 @@ export async function fetchCompletedTodos (store, forceLoad = false) {
|
||||
tasks.todos.push(...completedTodos);
|
||||
|
||||
store.state.completedTodosStatus = 'LOADED';
|
||||
} else if (status === 'LOADED') {
|
||||
return;
|
||||
} else if (loadStatus === 'LOADING') {
|
||||
const watcher = store.watch(state => state.completedTodosStatus, (newLoadingStatus) => {
|
||||
watcher(); // remove the watcher
|
||||
if (newLoadingStatus === 'LOADED') {
|
||||
return;
|
||||
} else {
|
||||
throw new Error(); // TODO add reason?
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import memberHasClass from 'common/script/libs/hasClass';
|
||||
|
||||
export function isBuffed () {
|
||||
return (member) => {
|
||||
const buffs = member.stats.buffs;
|
||||
@@ -6,7 +8,5 @@ export function isBuffed () {
|
||||
}
|
||||
|
||||
export function hasClass () {
|
||||
return (member) => {
|
||||
return member.stats.lvl >= 10 && !member.preferences.disableClasses && member.flags.classSelected;
|
||||
};
|
||||
return memberHasClass;
|
||||
}
|
||||
Reference in New Issue
Block a user