enzostvs HF staff commited on
Commit
4712663
β€’
1 Parent(s): 82ce458

delete image from storage as well

Browse files
src/routes/api/community/[id]/+server.ts CHANGED
@@ -1,4 +1,7 @@
1
  import { json, type RequestEvent } from '@sveltejs/kit';
 
 
 
2
  import prisma from '$lib/prisma';
3
  import { tokenIsAvailable } from '$lib/utils';
4
 
@@ -154,6 +157,8 @@ export async function DELETE({ params, cookies }: RequestEvent) {
154
  }
155
  })
156
 
 
 
157
  return json({
158
  success: true
159
  })
 
1
  import { json, type RequestEvent } from '@sveltejs/kit';
2
+ import { promises } from 'fs';
3
+ import { env } from '$env/dynamic/public';
4
+
5
  import prisma from '$lib/prisma';
6
  import { tokenIsAvailable } from '$lib/utils';
7
 
 
157
  }
158
  })
159
 
160
+ await promises.unlink(`${env.PUBLIC_FILE_UPLOAD_DIR}/${gallery?.image}`)
161
+
162
  return json({
163
  success: true
164
  })