feat: newbie profiles and notes updating

This commit is contained in:
DIYgod
2023-01-16 19:34:15 +00:00
parent d032e0f671
commit 209d35d603
6 changed files with 1165 additions and 150 deletions
+10 -10
View File
@@ -53,8 +53,8 @@
"ethers": "5.7.2",
"fast-deep-equal": "3.1.3",
"idb-keyval": "6.2.0",
"immer": "9.0.17",
"ioredis": "5.2.4",
"immer": "9.0.18",
"ioredis": "5.2.5",
"js-yaml": "4.1.0",
"jsonfeed-to-rss": "^3.0.6",
"mdast-util-to-string": "3.1.0",
@@ -67,7 +67,7 @@
"prismjs": "1.29.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "7.42.0",
"react-hook-form": "7.42.1",
"react-hot-toast": "2.4.0",
"react-infinite-scroller": "1.2.6",
"react-scroll": "1.8.9",
@@ -92,21 +92,21 @@
"remark-stringify": "10.0.2",
"sharp": "0.31.3",
"sortablejs": "1.15.0",
"unidata.js": "0.7.11",
"unidata.js": "0.7.12",
"unified": "10.1.2",
"unist-builder": "3.0.0",
"unist-util-visit": "4.1.1",
"use-onclickoutside": "0.4.1",
"uuid": "9.0.0",
"wagmi": "0.8.10",
"zustand": "4.3.1"
"wagmi": "0.10.10",
"zustand": "4.3.2"
},
"devDependencies": {
"@iconify-json/bi": "1.1.14",
"@iconify-json/bxs": "1.1.5",
"@iconify-json/carbon": "1.1.13",
"@iconify-json/fluent": "1.1.17",
"@iconify-json/mdi": "1.1.42",
"@iconify-json/mdi": "1.1.43",
"@next/bundle-analyzer": "13.1.2",
"@playwright/test": "1.29.2",
"@tailwindcss/line-clamp": "^0.4.2",
@@ -127,14 +127,14 @@
"@unocss/preset-icons": "0.48.4",
"autoprefixer": "10.4.13",
"cross-spawn": "7.0.3",
"esbuild": "0.16.17",
"esbuild": "0.17.1",
"esbuild-register": "3.4.2",
"eslint": "8.31.0",
"eslint": "8.32.0",
"eslint-config-next": "13.1.2",
"husky": "8.0.3",
"lint-staged": "13.1.0",
"postcss-import": "15.1.0",
"prettier": "2.8.2",
"prettier": "2.8.3",
"tailwindcss": "3.2.4",
"typescript": "4.9.4",
"unocss": "0.48.4",
+1134 -137
View File
File diff suppressed because it is too large Load Diff
+11
View File
@@ -55,6 +55,7 @@ export async function createOrUpdatePage(
applications?: string[]
},
customUnidata?: Unidata,
newbieToken?: string,
) {
if (!input.published) {
return await (customUnidata || unidata).notes.set(
@@ -67,6 +68,9 @@ export async function createOrUpdatePage(
{
id: input.pageId,
},
{
newbieToken,
},
)
}
return await (customUnidata || unidata).notes.set(
@@ -115,6 +119,9 @@ export async function createOrUpdatePage(
],
}),
},
{
newbieToken,
},
)
}
@@ -391,6 +398,7 @@ export async function getPage<TRender extends boolean = false>(
export async function deletePage(
{ site, id }: { site: string; id: string },
customUnidata?: Unidata,
newbieToken?: string,
) {
return await (customUnidata || unidata).notes.set(
{
@@ -402,6 +410,9 @@ export async function deletePage(
{
id,
},
{
newbieToken,
},
)
}
+4
View File
@@ -303,6 +303,7 @@ export async function updateSite(
}
},
customUnidata?: Unidata,
newbieToken?: string,
) {
return await (customUnidata || unidata).profiles.set(
{
@@ -357,6 +358,9 @@ export async function updateSite(
],
}),
},
{
newbieToken,
},
)
}
+4 -2
View File
@@ -139,11 +139,12 @@ export const useCheckMint = (pageId: string | undefined) => {
}
export function useCreateOrUpdatePage() {
const newbieToken = useAccountState((s) => s.email?.token)
const unidata = useUnidata()
const queryClient = useQueryClient()
const mutation = useMutation(
async (payload: Parameters<typeof pageModel.createOrUpdatePage>[0]) => {
return pageModel.createOrUpdatePage(payload, unidata)
return pageModel.createOrUpdatePage(payload, unidata, newbieToken)
},
{
onSuccess: (data, variables) => {
@@ -156,11 +157,12 @@ export function useCreateOrUpdatePage() {
}
export function useDeletePage() {
const newbieToken = useAccountState((s) => s.email?.token)
const unidata = useUnidata()
const queryClient = useQueryClient()
return useMutation(
async (input: Parameters<typeof pageModel.deletePage>[0]) => {
return pageModel.deletePage(input, unidata)
return pageModel.deletePage(input, unidata, newbieToken)
},
{
onSuccess: (data, variables) => {
+2 -1
View File
@@ -80,11 +80,12 @@ export const useGetSiteToSubscriptions = (data: { siteId: string }) => {
}
export function useUpdateSite() {
const newbieToken = useAccountState((s) => s.email?.token)
const unidata = useUnidata()
const queryClient = useQueryClient()
const mutation = useMutation(
async (payload: Parameters<typeof siteModel.updateSite>[0]) => {
return siteModel.updateSite(payload, unidata)
return siteModel.updateSite(payload, unidata, newbieToken)
},
{
onSuccess: (data, variables) => {