mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
public commit
This commit is contained in:
33
app/src/ui/client/schema/auth/use-bknd-auth.ts
Normal file
33
app/src/ui/client/schema/auth/use-bknd-auth.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { useBknd } from "ui/client";
|
||||
|
||||
export function useBkndAuth() {
|
||||
//const client = useClient();
|
||||
const { config, app, schema, actions: bkndActions } = useBknd();
|
||||
|
||||
const actions = {
|
||||
roles: {
|
||||
add: async (name: string, data: any = {}) => {
|
||||
console.log("add role", name, data);
|
||||
return await bkndActions.add("auth", `roles.${name}`, data);
|
||||
},
|
||||
patch: async (name: string, data: any) => {
|
||||
console.log("patch role", name, data);
|
||||
return await bkndActions.patch("auth", `roles.${name}`, data);
|
||||
},
|
||||
delete: async (name: string) => {
|
||||
console.log("delete role", name);
|
||||
if (window.confirm(`Are you sure you want to delete the role "${name}"?`)) {
|
||||
return await bkndActions.remove("auth", `roles.${name}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
const $auth = {};
|
||||
|
||||
return {
|
||||
$auth,
|
||||
config: config.auth,
|
||||
schema: schema.auth,
|
||||
actions
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user