view sitekey route and redirection

This commit is contained in:
realaravinth 2021-05-26 12:51:23 +05:30
parent 3d8cd9daed
commit bfc6bca73c
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
4 changed files with 5 additions and 4 deletions

View file

@ -31,7 +31,7 @@ pub mod routes {
Sitekey {
list: "/sitekey/list",
add: "/sitekey/add",
view: "/sitekey/{key}/view",
view: "/sitekey/view/{key}",
}
}
}

View file

@ -115,7 +115,7 @@ mod test {
let mut app = get_app!(data).await;
let url = format!("/sitekey/{}/view", &key.key);
let url = format!("/sitekey/view/{}", &key.key);
let list_sitekey_resp = test::call_service(
&mut app,

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',
};