TownieLayoutRoute.tsx1 match
45export function LayoutRoute () {
6// TODO fetch here because we're not doing any caching
7// and we want the user data in the header ?
8// const projects = useProjects();
TownieChatRoute.tsx8 matches
46files={project.data?.files}
47branchId={branchId}
48refetch={project.refetch}
49/>
50</>
56files,
57branchId,
58refetch,
59}: {
60project: any;
61files: any[];
62branchId: string;
63refetch: () => void;
64}) {
65const { token, anthropicApiKey } = useAuth();
93if (!messages?.length) return;
94let last = messages.at(-1);
95if (shouldRefetch(last)) {
96refetch();
97}
98}, [messages]);
177}
178179function shouldRefetch (message) {
180for (let i = 0; i < message?.parts?.length; i++) {
181let part = message.parts[i];
184case "str_replace_editor":
185if (part.toolInvocation?.args?.command === "create") {
186// console.log("REFETCH (create)");
187return true;
188}
190case "delete_file":
191case "change_val_type":
192// console.log("REFETCH (change type or delete)");
193return true;
194}
TownieBranchSelect.tsx1 match
33return;
34}
35branches.refetch();
36if (res?.branch?.id) {
37navigate(`/chat/${projectId}/branch/${res.branch.id}`);
6364try {
65const response = await fetch("https://discord.com/api/v10/users/@me", {
66headers: {
67Authorization: `Bot ${DISCORD_BOT_TOKEN}`,
Townieusage-dashboard.ts3 matches
59// If we get here, authentication was successful
6061// Fetch all rows from the usage table
62// Fetch all rows from the usage table
63const allUsageData = await sqlite.execute(`SELECT * FROM ${USAGE_TABLE} ORDER BY timestamp DESC`);
6465// Fetch aggregated data grouped by user_id
66const groupedUsageData = await sqlite.execute(`
67SELECT
4849// Register the commands
50const response = await fetch(`https://discord.com/api/v10/${endpoint}`, {
51method: "PUT",
52headers: {
HHGtoMyDayNotebookView.tsx12 matches
67const [currentPage, setCurrentPage] = useState(1);
6869const fetchMemories = useCallback(async () => {
70setLoading(true);
71setError(null);
72try {
73const response = await fetch(API_BASE);
74if (!response.ok) {
75throw new Error(`HTTP error! status: ${response.status}`);
78setMemories(data);
79} catch (e) {
80console.error("Failed to fetch memories:", e);
81setError(e.message || "Failed to fetch memories.");
82} finally {
83setLoading(false);
8687useEffect(() => {
88fetchMemories();
89}, [fetchMemories]);
9091const handleAddMemory = async (e: React.FormEvent) => {
100101try {
102const response = await fetch(API_BASE, {
103method: "POST",
104headers: { "Content-Type": "application/json" },
112setNewMemoryTags("");
113setShowAddForm(false);
114await fetchMemories();
115} catch (e) {
116console.error("Failed to add memory:", e);
123124try {
125const response = await fetch(`${API_BASE}/${id}`, {
126method: "DELETE",
127});
129throw new Error(`HTTP error! status: ${response.status}`);
130}
131await fetchMemories();
132} catch (e) {
133console.error("Failed to delete memory:", e);
155156try {
157const response = await fetch(`${API_BASE}/${editingMemory.id}`, {
158method: "PUT",
159headers: { "Content-Type": "application/json" },
164}
165setEditingMemory(null);
166await fetchMemories();
167} catch (e) {
168console.error("Failed to update memory:", e);
HHGtoMyDayindex.ts2 matches
135));
136137// HTTP vals expect an exported "fetch handler"
138export default app.fetch;