mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-15 01:16:38 +00:00
Merge remote-tracking branch 'upstream/dev' into feature-i18n
This commit is contained in:
@@ -3,19 +3,22 @@
|
||||
import ResourceContext from "@app/contexts/resourceContext";
|
||||
import { GetResourceAuthInfoResponse } from "@server/routers/resource";
|
||||
import { GetResourceResponse } from "@server/routers/resource/getResource";
|
||||
import { GetSiteResponse } from "@server/routers/site";
|
||||
import { useState } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
|
||||
interface ResourceProviderProps {
|
||||
children: React.ReactNode;
|
||||
resource: GetResourceResponse;
|
||||
site: GetSiteResponse | null;
|
||||
authInfo: GetResourceAuthInfoResponse;
|
||||
}
|
||||
|
||||
export function ResourceProvider({
|
||||
children,
|
||||
site,
|
||||
resource: serverResource,
|
||||
authInfo: serverAuthInfo,
|
||||
authInfo: serverAuthInfo
|
||||
}: ResourceProviderProps) {
|
||||
const [resource, setResource] =
|
||||
useState<GetResourceResponse>(serverResource);
|
||||
@@ -37,7 +40,7 @@ export function ResourceProvider({
|
||||
|
||||
return {
|
||||
...prev,
|
||||
...updatedResource,
|
||||
...updatedResource
|
||||
};
|
||||
});
|
||||
};
|
||||
@@ -56,14 +59,14 @@ export function ResourceProvider({
|
||||
|
||||
return {
|
||||
...prev,
|
||||
...updatedAuthInfo,
|
||||
...updatedAuthInfo
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<ResourceContext.Provider
|
||||
value={{ resource, updateResource, authInfo, updateAuthInfo }}
|
||||
value={{ resource, updateResource, site, authInfo, updateAuthInfo }}
|
||||
>
|
||||
{children}
|
||||
</ResourceContext.Provider>
|
||||
|
||||
Reference in New Issue
Block a user