mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2024-11-23 09:55:57 +03:00
view sitekey route and redirection
This commit is contained in:
parent
3d8cd9daed
commit
bfc6bca73c
4 changed files with 5 additions and 4 deletions
|
@ -31,7 +31,7 @@ pub mod routes {
|
|||
Sitekey {
|
||||
list: "/sitekey/list",
|
||||
add: "/sitekey/add",
|
||||
view: "/sitekey/{key}/view",
|
||||
view: "/sitekey/view/{key}",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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}`);
|
||||
|
|
|
@ -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',
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue