From 77ded2a3b9142073f1ea74b948ad3219c6b245df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Tue, 9 May 2023 12:47:26 +0800 Subject: Admin clearer, reimplement logout & default next --- admin.c | 12 ++++++++---- interchange/admin.h | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/admin.c b/admin.c index 28f88f6..7ce6ad2 100644 --- a/admin.c +++ b/admin.c @@ -11,7 +11,8 @@ void interchange_admin_login(const char *username, const char *password, const char *failpage, void (*handler)(interchange_response *), void (*callback)(struct interchange_admin *)) { - login(username, password, NULL, "MMLogin", nextpage, successpage, + login(username, password, NULL, "MMLogin", + nextpage ? nextpage : "admin/index", successpage, failpage, handler, (void (*)(void *))callback); } @@ -86,12 +87,15 @@ void interchange_admin_new_transaction(const struct interchange_ord_order *order }}, "%s", "process"); } -void interchange_admin_logout(struct interchange_admin *admin, void (*handler)(interchange_response *)) +void interchange_admin_logout() +{ + request(NULL, NULL, NULL, "%s", "admin/login"); +} + +void interchange_admin_clear(struct interchange_admin *admin) { - request(handler, NULL, NULL, "%s", "admin/login"); if (admin->name) free(admin->name); if (admin->username) free(admin->username); - free(admin); } diff --git a/interchange/admin.h b/interchange/admin.h index eccace7..fd2ce09 100644 --- a/interchange/admin.h +++ b/interchange/admin.h @@ -32,7 +32,8 @@ void interchange_admin_new_item(const char *description, const char *comment, co void interchange_admin_new_transaction(const struct interchange_ord_order *order, const struct interchange_member *member, bool new_customer_id, void (*handler)(interchange_response *)); -void interchange_admin_logout(struct interchange_admin *admin, void (*handler)(interchange_response *)); +void interchange_admin_logout(); +void interchange_admin_clear(struct interchange_admin *admin); #ifdef __cplusplus } -- cgit v1.2.3