Void changes

This commit is contained in:
2025-08-22 17:38:09 +01:00
parent 4e193ab1b2
commit bdca42213d
5 changed files with 16 additions and 11 deletions

8
package-lock.json generated
View File

@ -8319,16 +8319,16 @@
} }
}, },
"node_modules/react-syntax-highlighter": { "node_modules/react-syntax-highlighter": {
"version": "15.6.1", "version": "15.6.3",
"resolved": "https://registry.npmjs.org/react-syntax-highlighter/-/react-syntax-highlighter-15.6.1.tgz", "resolved": "https://registry.npmjs.org/react-syntax-highlighter/-/react-syntax-highlighter-15.6.3.tgz",
"integrity": "sha512-OqJ2/vL7lEeV5zTJyG7kmARppUjiB9h9udl4qHQjjgEos66z00Ia0OckwYfRxCSFrW8RJIBnsBwQsHZbVPspqg==", "integrity": "sha512-HebdyA9r20hgmA0q8RyRJ4c/vB4E6KL2HeWb5MNjU3iJEiT2w9jfU2RJsmI6f3Cy3SGE5tm0AIkBzM/E7e9/lQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.3.1", "@babel/runtime": "^7.3.1",
"highlight.js": "^10.4.1", "highlight.js": "^10.4.1",
"highlightjs-vue": "^1.0.0", "highlightjs-vue": "^1.0.0",
"lowlight": "^1.17.0", "lowlight": "^1.17.0",
"prismjs": "^1.27.0", "prismjs": "^1.30.0",
"refractor": "^3.6.0" "refractor": "^3.6.0"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -56,7 +56,7 @@ export function useCreateScript() {
return useMutation({ return useMutation({
mutationFn: ({ data, userId }: { data: scriptsApi.CreateScriptData; userId: string }) => mutationFn: ({ data, userId }: { data: scriptsApi.CreateScriptData; userId: string }) =>
scriptsApi.createScript(data, userId), scriptsApi.createScript({...data, authorId: userId, authorName: data.authorName || 'User'}, userId),
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryKey: scriptKeys.lists() }); queryClient.invalidateQueries({ queryKey: scriptKeys.lists() });
showSuccess('Script created successfully!'); showSuccess('Script created successfully!');

View File

@ -39,7 +39,7 @@ export interface ScriptFilters {
} }
// Create a new script // Create a new script
export async function createScript(data: CreateScriptData) { export async function createScript(data: CreateScriptData, userId?: string) {
try { try {
const scriptId = generateId(); const scriptId = generateId();
const now = new Date(); const now = new Date();

View File

@ -74,7 +74,12 @@ app.post('/api/scripts', async (req: Request, res: Response) => {
if (!userId) { if (!userId) {
return res.status(401).json({ error: 'Unauthorized' }); return res.status(401).json({ error: 'Unauthorized' });
} }
const result = await createScript(req.body, userId); // Make sure userId is included in the request body
const scriptData = {
...req.body,
authorId: userId
};
const result = await createScript(scriptData, userId);
res.json(result); res.json(result);
} catch (error) { } catch (error) {
console.error('Create script error:', error); console.error('Create script error:', error);

View File

@ -15,10 +15,10 @@
"jsx": "react-jsx", "jsx": "react-jsx",
/* Linting */ /* Linting */
"strict": false, "strict": true,
"noImplicitAny": false, "noImplicitAny": true,
"noUnusedLocals": false, "noUnusedLocals": true,
"noUnusedParameters": false, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
/* Path mapping */ /* Path mapping */