This commit is contained in:
MuslemRahimi 2025-02-21 18:47:47 +01:00
parent c9df82745f
commit 3323ad1b69
2 changed files with 1 additions and 46 deletions

View File

@ -17,25 +17,9 @@ export const load = async ({ locals }) => {
return output; return output;
}; };
const getEggPrice = async () => {
// make the POST request to the endpoint
const response = await fetch(apiURL + "/egg-price", {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-KEY": apiKey,
},
});
const output = await response.json();
return output;
};
// Make sure to return a promise // Make sure to return a promise
return { return {
getData: await getData(), getData: await getData(),
getEggPrice: await getEggPrice(),
}; };
}; };

View File

@ -2,28 +2,8 @@
import SEO from "$lib/components/SEO.svelte"; import SEO from "$lib/components/SEO.svelte";
import Map from "$lib/components/Map.svelte"; import Map from "$lib/components/Map.svelte";
import Infobox from "$lib/components/Infobox.svelte"; import Infobox from "$lib/components/Infobox.svelte";
import { monthNames } from "$lib/utils";
import { screenWidth } from "$lib/store";
import ArrowLogo from "lucide-svelte/icons/move-up-right"; import ArrowLogo from "lucide-svelte/icons/move-up-right";
import { init, use } from "echarts/core";
import { LineChart, BarChart } from "echarts/charts";
import {
GridComponent,
TooltipComponent,
LegendComponent,
} from "echarts/components";
import { CanvasRenderer } from "echarts/renderers";
use([
LineChart,
BarChart,
GridComponent,
TooltipComponent,
LegendComponent,
CanvasRenderer,
]);
export let data; export let data;
let rawData = data?.getData?.history || []; let rawData = data?.getData?.history || [];
@ -54,15 +34,6 @@
}, {}); }, {});
const tabs = [ const tabs = [
{
title: "Location Tracker",
},
{
title: "Egg Price Tracker",
},
];
const subTabs = [
{ {
title: "Presidential Schedule", title: "Presidential Schedule",
}, },
@ -168,7 +139,7 @@
<ul <ul
class="flex flex-row items-center w-full text-[1rem] text-white" class="flex flex-row items-center w-full text-[1rem] text-white"
> >
{#each subTabs as item, i} {#each tabs as item, i}
<button <button
on:click={() => (subActiveIdx = i)} on:click={() => (subActiveIdx = i)}
class="p-2 px-5 cursor-pointer {subActiveIdx === i class="p-2 px-5 cursor-pointer {subActiveIdx === i