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

View File

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

View File

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

View File

@ -74,7 +74,12 @@ app.post('/api/scripts', async (req: Request, res: Response) => {
if (!userId) {
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);
} catch (error) {
console.error('Create script error:', error);

View File

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