view sitekey route and redirection

This commit is contained in:
realaravinth
2021-05-26 12:51:23 +05:30
parent 3d8cd9daed
commit bfc6bca73c
4 changed files with 5 additions and 4 deletions

View File

@@ -54,7 +54,8 @@ const submit = async (e: Event) => {
const res = await fetch(formUrl, genJsonPayload(payload));
if (res.ok) {
alert('success');
window.location.assign(VIEWS.listSitekey);
const data = await res.json();
window.location.assign(VIEWS.listSitekey(data.key));
} else {
const err = await res.json();
alert(`error: ${err.error}`);

View File

@@ -21,7 +21,7 @@ const ROUTES = {
signoutUser: '/api/v1/signout',
panelHome: '/',
docsHome: '/docs/',
listSitekey: '/sitekey/view',
listSitekey: (key: string) => `/sitekey/view/${key}`,
addSiteKey: '/sitekey/add',
};