mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-04 04:59:40 +00:00
* View party now opens member modal * Clicking member in header opens member detail modal * Began sticky header * Added sleep * Removed extra inbox and added name styles * Lint fixes * Added member filter * Added task counts * Updated quest start modal * Updated members modal style * Fixed editing party * Updated tavern * Updated my guilds * More guild styles * Many challenge styles and fixes * Fixed notification menu display * Added initial styles to groupplans * Added syncing with inbox * Fixed lint * Added new edit profile layout * Added initial achievement layout * Began adding new stats layout * Removed duplicate: * fix(CI): attempt to address Travis Mongo connection issue * fix(CI): don't strand us in Mongo shell * Travis updates * Try percise
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
import { loadAsyncResource } from 'client/libs/asyncResource';
|
|
import setProps from 'lodash/set';
|
|
import axios from 'axios';
|
|
|
|
export function fetch (store, forceLoad = false) { // eslint-disable-line no-shadow
|
|
return loadAsyncResource({
|
|
store,
|
|
path: 'user',
|
|
url: '/api/v3/user',
|
|
deserialize (response) {
|
|
return response.data.data;
|
|
},
|
|
forceLoad,
|
|
});
|
|
}
|
|
|
|
export function set (store, changes) {
|
|
const user = store.state.user.data;
|
|
|
|
for (let key in changes) {
|
|
setProps(user, key, changes[key]);
|
|
}
|
|
|
|
axios.put('/api/v3/user', changes);
|
|
// TODO
|
|
// .then((res) => console.log('set', res))
|
|
// .catch((err) => console.error('set', err));
|
|
}
|
|
|
|
export async function sleep () {
|
|
let response = await axios.post('/api/v3/user/sleep');
|
|
return response.data.data;
|
|
}
|
|
|
|
export async function addWebhook (store, payload) {
|
|
let response = await axios.post('/api/v3/user/webhook', payload.webhookInfo);
|
|
return response.data.data;
|
|
}
|
|
|
|
export async function updateWebhook (store, payload) {
|
|
let response = await axios.put(`/api/v3/user/webhook/${payload.webhook.id}`, payload.webhook);
|
|
return response.data.data;
|
|
}
|
|
|
|
export async function deleteWebhook (store, payload) {
|
|
let response = await axios.delete(`/api/v3/user/webhook/${payload.webhook.id}`);
|
|
return response.data.data;
|
|
}
|