Adrien Denat commited on
Commit
7b62aec
1 Parent(s): 697285c

redirect /conversation -> / (#50)

Browse files

* redirect /conversation -> /

* don't use url.origin in redirect

Files changed (1) hide show
  1. src/routes/conversation/+server.ts +6 -0
src/routes/conversation/+server.ts CHANGED
@@ -1,6 +1,8 @@
1
  import type { RequestHandler } from './$types';
2
  import { collections } from '$lib/server/database';
3
  import { ObjectId } from 'mongodb';
 
 
4
 
5
  export const POST: RequestHandler = async (input) => {
6
  const res = await collections.conversations.insertOne({
@@ -21,3 +23,7 @@ export const POST: RequestHandler = async (input) => {
21
  { headers: { 'Content-Type': 'application/json' } }
22
  );
23
  };
 
 
 
 
 
1
  import type { RequestHandler } from './$types';
2
  import { collections } from '$lib/server/database';
3
  import { ObjectId } from 'mongodb';
4
+ import { redirect } from '@sveltejs/kit';
5
+ import { base } from '$app/paths';
6
 
7
  export const POST: RequestHandler = async (input) => {
8
  const res = await collections.conversations.insertOne({
 
23
  { headers: { 'Content-Type': 'application/json' } }
24
  );
25
  };
26
+
27
+ export const GET: RequestHandler = async () => {
28
+ throw redirect(301, base || '/');
29
+ };