Hopefully fix ui mismatch on strikes page
This commit is contained in:
parent
436427aff0
commit
19a7dbb6e5
@ -24,7 +24,7 @@ import {
|
|||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { LoaderFunctionArgs } from "@remix-run/cloudflare";
|
import { LoaderFunctionArgs } from "@remix-run/cloudflare";
|
||||||
import { useLoaderData } from "@remix-run/react";
|
import { useLoaderData } from "@remix-run/react";
|
||||||
import { useEffect, useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
export async function loader({
|
export async function loader({
|
||||||
context,
|
context,
|
||||||
@ -60,15 +60,11 @@ export async function loader({
|
|||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
const { can_manage, strikes, user } = useLoaderData<typeof loader>();
|
const { can_manage, strikes, user } = useLoaderData<typeof loader>();
|
||||||
const [strikeData, setStrikeData] = useState([] as typeof strikes);
|
const [strikeData, setStrikeData] = useState(strikes);
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
const [rmStrikeId, setRmStrikeId] = useState("");
|
const [rmStrikeId, setRmStrikeId] = useState("");
|
||||||
const [strikeReason, setStrikeReason] = useState("");
|
const [strikeReason, setStrikeReason] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setStrikeData(strikes);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
async function removeStrike(id: string) {
|
async function removeStrike(id: string) {
|
||||||
const removeResp = await fetch(`/api/events-team/strikes/${id}`, {
|
const removeResp = await fetch(`/api/events-team/strikes/${id}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
@ -208,10 +204,12 @@ export default function () {
|
|||||||
<TableContainer>
|
<TableContainer>
|
||||||
<Table variant="simple">
|
<Table variant="simple">
|
||||||
<Thead>
|
<Thead>
|
||||||
<Th>Time Added</Th>
|
<Tr>
|
||||||
<Th>Added By</Th>
|
<Th>Time Added</Th>
|
||||||
<Th>Reason</Th>
|
<Th>Added By</Th>
|
||||||
<Th>Remove</Th>
|
<Th>Reason</Th>
|
||||||
|
<Th>Remove</Th>
|
||||||
|
</Tr>
|
||||||
</Thead>
|
</Thead>
|
||||||
<Tbody>
|
<Tbody>
|
||||||
{strikeData.map((strike: { [k: string]: any }) => (
|
{strikeData.map((strike: { [k: string]: any }) => (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user