mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-27 15:26:41 +00:00
I18n additionals (#125)
* New translation keys * Updates in src/components * Updates in src/providers * remove lable in selector, not needed --------- Co-authored-by: Lokowitz <marvinlokowitz@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import ResourceContext from "@app/contexts/resourceContext";
|
||||
import { GetResourceAuthInfoResponse } from "@server/routers/resource";
|
||||
import { GetResourceResponse } from "@server/routers/resource/getResource";
|
||||
import { useState } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
interface ResourceProviderProps {
|
||||
children: React.ReactNode;
|
||||
@@ -22,9 +23,11 @@ export function ResourceProvider({
|
||||
const [authInfo, setAuthInfo] =
|
||||
useState<GetResourceAuthInfoResponse>(serverAuthInfo);
|
||||
|
||||
const t = useTranslations();
|
||||
|
||||
const updateResource = (updatedResource: Partial<GetResourceResponse>) => {
|
||||
if (!resource) {
|
||||
throw new Error("No resource to update");
|
||||
throw new Error(t('resourceErrorNoUpdate'));
|
||||
}
|
||||
|
||||
setResource((prev) => {
|
||||
@@ -43,7 +46,7 @@ export function ResourceProvider({
|
||||
updatedAuthInfo: Partial<GetResourceAuthInfoResponse>
|
||||
) => {
|
||||
if (!authInfo) {
|
||||
throw new Error("No auth info to update");
|
||||
throw new Error(t('authErrorNoUpdate'));
|
||||
}
|
||||
|
||||
setAuthInfo((prev) => {
|
||||
|
||||
Reference in New Issue
Block a user