@opengis/admin 0.1.63 → 0.1.64
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
package/server/plugins/hook.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import config from '../../config.js'
|
2
|
+
import { addHook, getToken, setToken, getTemplate } from '@opengis/fastify-table/utils.js';
|
2
3
|
|
3
4
|
async function getTokenData({
|
4
5
|
req, mode = 'w', token, uid,
|
@@ -28,8 +29,9 @@ export default async function plugin(fastify) {
|
|
28
29
|
|
29
30
|
addHook('preTable', async ({ req, table, user = {} }) => {
|
30
31
|
const { uid } = config?.auth?.disable ? { uid: '1' } : user || {};
|
31
|
-
|
32
|
-
|
32
|
+
|
33
|
+
//const opt = await getTokenData({ req, mode: 'w', token: table, uid });
|
34
|
+
// return opt;
|
33
35
|
});
|
34
36
|
addHook('preData', async ({ req, table, id, user = {} }) => {
|
35
37
|
const { uid } = config?.auth?.disable ? { uid: '1' } : user || {};
|
@@ -2,10 +2,11 @@ import { applyHook, getTemplate } from "@opengis/fastify-table/utils.js";
|
|
2
2
|
|
3
3
|
export default async function getTemplateApi(req) {
|
4
4
|
const { user } = req?.session?.passport || {};
|
5
|
+
const { funcs, params = {}, session = {} } = req;
|
5
6
|
const res = await applyHook('preTemplate', { req, name: params?.name, type: params?.type, user });
|
6
7
|
if (res) return res;
|
7
8
|
|
8
|
-
|
9
|
+
|
9
10
|
const { type, name } = params;
|
10
11
|
|
11
12
|
const data = await getTemplate(type, name);
|