Skip to content

Commit 2e10ab5

Browse files
committed
add redirection for trase widgets
1 parent 0f93172 commit 2e10ab5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { stringify } from 'query-string';
2+
3+
export const getServerSideProps = async ({ res, query }) => {
4+
const { widget, location, ...rest } = query || {};
5+
res.statusCode = 302;
6+
res.setHeader(
7+
'Location',
8+
`/embed/widget/${widget}/${location.join('/')}${
9+
rest ? `?${stringify(rest)}` : ''
10+
}`
11+
); // Replace <link> with your url link
12+
13+
return { props: {} };
14+
};
15+
16+
const WidgetEmbedLegacyPage = () => {
17+
return null;
18+
};
19+
20+
export default WidgetEmbedLegacyPage;

0 commit comments

Comments
 (0)