+
+ {
+ setFirstName(e.target.value);
+ }}
+ />
+ {
+ setLastName(e.target.value);
+ }}
+ />
+
+
{
+ const response = await fetch(`${BACKEND_API_URL}/users/metadata`, {
+ method: "PUT",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ firstName,
+ lastName,
+ }),
+ });
+ setMetadata({
+ firstName,
+ lastName,
+ });
+
+ nav.pop();
+ }}
+ />
+
+ );
+};
diff --git a/packages/recoil/src/atoms/index.tsx b/packages/recoil/src/atoms/index.tsx
index d477ca0d7..ebcb78c50 100644
--- a/packages/recoil/src/atoms/index.tsx
+++ b/packages/recoil/src/atoms/index.tsx
@@ -6,6 +6,7 @@ export * from "./ethereum";
export * from "./feature-gates";
export * from "./friendship";
export * from "./keyring";
+export * from "./metadata";
export * from "./nft";
export * from "./notifications";
export * from "./preferences";
diff --git a/packages/recoil/src/atoms/metadata.ts b/packages/recoil/src/atoms/metadata.ts
new file mode 100644
index 000000000..290dde963
--- /dev/null
+++ b/packages/recoil/src/atoms/metadata.ts
@@ -0,0 +1,22 @@
+import { BACKEND_API_URL } from "@coral-xyz/common";
+import { atom, selector } from "recoil";
+
+export const userMetadata = atom<{
+ firstName: string;
+ lastName: string;
+} | null>({
+ key: "userMetadata",
+ default: selector({
+ key: "userMetadataSelector",
+ get: async ({ get }) => {
+ const response = await fetch(`${BACKEND_API_URL}/users/metadata`, {
+ method: "GET",
+ });
+ const json = await response.json();
+ return {
+ firstName: json.firstName,
+ lastName: json.lastName,
+ };
+ },
+ }),
+});