Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
chore: resolve breaking change with latest payload, add toast on succ…
Browse files Browse the repository at this point in the history
…ess/error
  • Loading branch information
r1tsuu committed Apr 26, 2024
1 parent 8f3dfec commit 4338879
Show file tree
Hide file tree
Showing 10 changed files with 1,741 additions and 8,468 deletions.
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
},
"devDependencies": {
"@next/eslint-plugin-next": "^14.1.4",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.4.16",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"copyfiles": "^2.4.1",
Expand All @@ -21,8 +23,16 @@
"prettier-plugin-css-order": "^2.0.1",
"rimraf": "^5.0.5",
"typescript": "^5.4.2",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.4.16"
"@payloadcms/db-mongodb": "3.0.0-beta.18",
"@payloadcms/db-postgres": "3.0.0-beta.18",
"@payloadcms/next": "3.0.0-beta.18",
"@payloadcms/richtext-lexical": "3.0.0-beta.18",
"@payloadcms/richtext-slate": "3.0.0-beta.18",
"@payloadcms/ui": "3.0.0-beta.18",
"@payloadcms/translations": "3.0.0-beta.18",
"payload": "3.0.0-beta.18",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"keywords": [],
"author": "",
Expand Down
14 changes: 7 additions & 7 deletions plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@r1tsu/payload-plugin-collections-docs-order",
"private": false,
"version": "1.0.0-beta.5",
"version": "1.0.0-beta.6",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -13,15 +13,15 @@
"prepublishOnly": "pnpm clean && pnpm build"
},
"peerDependencies": {
"@payloadcms/ui": "3.0.0-beta.6",
"payload": "3.0.0-beta.6"
"@payloadcms/ui": "^3.0.0-beta.18",
"payload": "^3.0.0-beta.18"
},
"devDependencies": {
"@payloadcms/ui": "3.0.0-beta.6",
"@payloadcms/ui": "../node_modules/@payloadcms/ui",
"@types/react": "^18.2.64",
"payload": "3.0.0-beta.6",
"react": "^18.2.0",
"typescript": "^5.2.2"
"payload": "../node_modules/payload",
"react": "../node_modules/react",
"typescript": "^5.4.2"
},
"types": "./src/index.ts",
"main": "./src/index.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { Button } from '@payloadcms/ui/elements';
import { Button, toast } from '@payloadcms/ui/elements';
import { DraggableSortable } from '@payloadcms/ui/elements/DraggableSortable';
import { DraggableSortableItem } from '@payloadcms/ui/elements/DraggableSortable/DraggableSortableItem';
import { Radio } from '@payloadcms/ui/fields/RadioGroup/Radio';
Expand Down Expand Up @@ -128,10 +128,13 @@ const CollectionDocsOrderContent = () => {
if (success) {
setData((prev) => ({ ...prev, isLoading: true }));
await getInitalData();
// toast.success(t("pluginCollectionsDocsOrder:success"), {
// position: "bottom-center",
// });
toast.success(t('pluginCollectionsDocsOrder:success'), {
position: 'bottom-center',
});
} else {
toast.success(t('pluginCollectionsDocsOrder:error'), {
position: 'bottom-center',
});
}
// toast.error(t("pluginCollectionsDocsOrder:error"), {
// position: "bottom-center",
Expand Down
4 changes: 3 additions & 1 deletion plugin/src/handlers/saveChanges.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ export const saveChanges = async ({
method: 'post',
});

return await response.json();
if (!response.ok) return { success: false };

return response.json();
};
2 changes: 1 addition & 1 deletion plugin/src/handlers/saveChanges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const schema = z.object({
export const saveChanges =
({ access }: { access: NonNullable<PluginOptions['access']> }): PayloadHandler =>
async (req) => {
const result = schema.safeParse(req.data);
const result = schema.safeParse(await req.json());

if (!result.success) return Response.json({ errors: result.error.errors }, { status: 400 });

Expand Down
Loading

0 comments on commit 4338879

Please sign in to comment.