summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-05-09 12:47:26 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-05-09 12:47:26 +0800
commit77ded2a3b9142073f1ea74b948ad3219c6b245df (patch)
treecc752af009ec36a8e2b572ef59cde422584d645e
parent813507ca1813ff6cb4ca0a35de4550c6178af235 (diff)
Admin clearer, reimplement logout & default next
-rw-r--r--admin.c12
-rw-r--r--interchange/admin.h3
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
}