initial: bootstrap from BukidBountyApp base

This commit is contained in:
Jonathan Sykes
2026-06-06 18:43:00 +08:00
commit eb4a5731fb
5674 changed files with 160857 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
import { ref } from 'vue';
import axios from 'axios';
export function useActivity() {
const activities = ref([]);
const loading = ref(false);
const error = ref(null);
const fetchRecentActivities = async (limit = 10) => {
loading.value = true;
error.value = null;
try {
const response = await axios.get('/api/activity/recent', {
params: { limit }
});
if (response.data.success) {
activities.value = response.data.data;
} else {
error.value = 'Failed to fetch activities';
}
} catch (err) {
error.value = err.message || 'Error connecting to activity service';
console.error('Activity fetch error:', err);
} finally {
loading.value = false;
}
};
const searchActivities = async (query, limit = 20) => {
loading.value = true;
error.value = null;
try {
const response = await axios.get('/api/activity/search', {
params: { q: query, limit }
});
if (response.data.success) {
activities.value = response.data.data;
}
} catch (err) {
error.value = err.message;
} finally {
loading.value = false;
}
};
return {
activities,
loading,
error,
fetchRecentActivities,
searchActivities
};
}