Skip to content

Commit

Permalink
fixed sitemap and queries
Browse files Browse the repository at this point in the history
  • Loading branch information
miha-bhaskaran committed Mar 16, 2024
1 parent bbc19c7 commit a59e13b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/userComponents/SiteMap/SiteMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Popup,
ZoomControl,
} from 'react-leaflet';
import { fetchDisplays } from '../../../supabase/displays/queries';
import { fetchAllDisplays } from '../../../supabase/displays/queries';
import { DisplayRow } from '../../../types/types';

const center: LatLngExpression = {
Expand All @@ -36,7 +36,7 @@ function SiteMap() {
*/
async function fetchData() {
try {
const data = await fetchDisplays();
const data = await fetchAllDisplays();
setDisplays(data);
} catch (error) {
console.error(error);
Expand Down
5 changes: 3 additions & 2 deletions src/supabase/displays/queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ export async function deleteDisplay(id: string) {
if (error) {
throw new Error(`An error occurred trying to delete displays: ${error}`);
} else {
fetchDisplays();
fetchDisplay(id);
}
}

/**
*
* @param displayData
* @param displayData - displays the data
* @returns a new display object
*/
export async function createDisplay(displayData: DisplayRow) {
const { data, error } = await supabase.from('displays').upsert([displayData]);
Expand Down

0 comments on commit a59e13b

Please sign in to comment.