mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-03-31 05:33:28 +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 {
|
Sitekey {
|
||||||
list: "/sitekey/list",
|
list: "/sitekey/list",
|
||||||
add: "/sitekey/add",
|
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 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(
|
let list_sitekey_resp = test::call_service(
|
||||||
&mut app,
|
&mut app,
|
||||||
|
|
|
@ -54,7 +54,8 @@ const submit = async (e: Event) => {
|
||||||
const res = await fetch(formUrl, genJsonPayload(payload));
|
const res = await fetch(formUrl, genJsonPayload(payload));
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
alert('success');
|
alert('success');
|
||||||
window.location.assign(VIEWS.listSitekey);
|
const data = await res.json();
|
||||||
|
window.location.assign(VIEWS.listSitekey(data.key));
|
||||||
} else {
|
} else {
|
||||||
const err = await res.json();
|
const err = await res.json();
|
||||||
alert(`error: ${err.error}`);
|
alert(`error: ${err.error}`);
|
||||||
|
|
|
@ -21,7 +21,7 @@ const ROUTES = {
|
||||||
signoutUser: '/api/v1/signout',
|
signoutUser: '/api/v1/signout',
|
||||||
panelHome: '/',
|
panelHome: '/',
|
||||||
docsHome: '/docs/',
|
docsHome: '/docs/',
|
||||||
listSitekey: '/sitekey/view',
|
listSitekey: (key: string) => `/sitekey/view/${key}`,
|
||||||
addSiteKey: '/sitekey/add',
|
addSiteKey: '/sitekey/add',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue