mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
Keep api/client.ts and trips.service.ts within their size baselines
The admin switch for wanderer moves to api/wanderer.ts and the recorded track restore to api/recordedTrack.ts; trips.service.ts keeps dev's formatting with only the derived-from remap on copy.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useEffectEvent, useState } from 'react';
|
||||
|
||||
import { adminApi } from '../../../api/client';
|
||||
import { wandererAdminApi } from '../../../api/wanderer';
|
||||
import { useTranslation } from '../../../i18n';
|
||||
import { useAddonStore } from '../../../store/addonStore';
|
||||
import { useToast } from '../../shared/Toast';
|
||||
@@ -31,8 +32,8 @@ export function useAddonManager() {
|
||||
|
||||
const loadOnMount = useEffectEvent(() => {
|
||||
void loadAddons().finally(() => setLoading(false));
|
||||
adminApi
|
||||
.getToursWanderer()
|
||||
wandererAdminApi
|
||||
.get()
|
||||
.then((flag) => setToursWanderer(flag.enabled))
|
||||
.catch(() => toast.error(t('admin.addons.toast.error')));
|
||||
});
|
||||
@@ -67,7 +68,7 @@ export function useAddonManager() {
|
||||
const next = !toursWanderer;
|
||||
setToursWanderer(next);
|
||||
try {
|
||||
await adminApi.updateToursWanderer(next);
|
||||
await wandererAdminApi.update(next);
|
||||
} catch {
|
||||
setToursWanderer(!next);
|
||||
toast.error(t('admin.addons.toast.error'));
|
||||
|
||||
Reference in New Issue
Block a user