thorin_17
thorin_17
TTCTheo's Typesafe Cult
Created by thorin_17 on 7/27/2023 in #questions
useState from TRPC Query
At the moment I just wanted a dropdown with all the values with the ability to see the current one
17 replies
TTCTheo's Typesafe Cult
Created by thorin_17 on 7/27/2023 in #questions
useState from TRPC Query
import Head from "next/head";
import { useState } from "react";
import Header from "~/components/header";
import { api } from "~/utils/api";

export default function Admin() {
const groups = api.group.getAll.useQuery();

if (!groups.data) return <p>No Data</p>
if (groups.error) return <p>Error</p>

const [group, setGroup] = useState(groups.data[0]?.id)

return (
<>
<Head>
<title>Admin | Group</title>
</Head>
<Header pageTitle="Admin"/>
<p>Admin index page</p>
<select name="group" value={group}>
{groups.data.map(option => {
<option id={option.id} value={option.id}>{option.name}</option>
})}
</select>
</>
)
}
import Head from "next/head";
import { useState } from "react";
import Header from "~/components/header";
import { api } from "~/utils/api";

export default function Admin() {
const groups = api.group.getAll.useQuery();

if (!groups.data) return <p>No Data</p>
if (groups.error) return <p>Error</p>

const [group, setGroup] = useState(groups.data[0]?.id)

return (
<>
<Head>
<title>Admin | Group</title>
</Head>
<Header pageTitle="Admin"/>
<p>Admin index page</p>
<select name="group" value={group}>
{groups.data.map(option => {
<option id={option.id} value={option.id}>{option.name}</option>
})}
</select>
</>
)
}
17 replies
TTCTheo's Typesafe Cult
Created by thorin_17 on 7/27/2023 in #questions
useState from TRPC Query
I think I"ve gotten myself confused sorry
17 replies
TTCTheo's Typesafe Cult
Created by thorin_17 on 7/27/2023 in #questions
useState from TRPC Query
I'm wanting to create a dropdown with select / option then run a useEffect to reupdate the data
17 replies
TTCTheo's Typesafe Cult
Created by thorin_17 on 5/13/2023 in #questions
How should I handle permissions for restricted pages?
Hi, sorry yes I can imagine it is very vague. I have many pages or resources in my app and would like to restric access to them based on permissions either through groups or directly
5 replies