@axium/server 0.39.1 → 0.39.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/linking.js
CHANGED
|
@@ -54,6 +54,14 @@ export function linkRoutes(options = {}) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
+
const hooksBuiltin = `
|
|
58
|
+
import { errorText } from '@axium/core/io';
|
|
59
|
+
|
|
60
|
+
export function handleError({ error, status }) {
|
|
61
|
+
console.error(error);
|
|
62
|
+
return { message: errorText(error), stack: error.stack, status: error.status || status };
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
57
65
|
export function writePluginHooks() {
|
|
58
66
|
const hooksPath = join(import.meta.dirname, '../.hooks.js');
|
|
59
67
|
io.start('Writing web client hooks for plugins');
|
|
@@ -64,6 +72,7 @@ export function writePluginHooks() {
|
|
|
64
72
|
const specifier = relative(resolve(import.meta.dirname, '..'), resolve(plugin.dirname, plugin.server.web_client_hooks));
|
|
65
73
|
hooks += `import '${specifier}';\n`;
|
|
66
74
|
}
|
|
75
|
+
hooks += hooksBuiltin;
|
|
67
76
|
writeFileSync(hooksPath, hooks, 'utf8');
|
|
68
77
|
io.done();
|
|
69
78
|
io.debug('Wrote', hooksPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/server",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.2",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"clean": "rm -rf build .svelte-kit node_modules/{.vite,.vite-temp}"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@axium/client": ">=0.
|
|
50
|
+
"@axium/client": ">=0.18.3",
|
|
51
51
|
"@axium/core": ">=0.21.0",
|
|
52
52
|
"kysely": "^0.28.0",
|
|
53
53
|
"utilium": "^2.6.0",
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { text } from '@axium/client';
|
|
2
|
+
import { deleteUser, fetchAPI, text } from '@axium/client';
|
|
3
3
|
import { ClipboardCopy, FormDialog, Icon, SessionList, ZodForm, ZodInput } from '@axium/client/components';
|
|
4
|
-
import {
|
|
4
|
+
import { toast } from '@axium/client/toast';
|
|
5
5
|
import '@axium/client/styles/account';
|
|
6
|
-
import { deleteUser } from '@axium/client/user';
|
|
7
6
|
import { preferenceLabels, Preferences, User } from '@axium/core';
|
|
8
7
|
import { formatDateRange } from '@axium/core/format';
|
|
9
8
|
|
|
@@ -14,8 +13,13 @@
|
|
|
14
13
|
let sessions = $state(user.sessions);
|
|
15
14
|
|
|
16
15
|
async function updateValue(val: User) {
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
try {
|
|
17
|
+
const result = await fetchAPI('PATCH', 'admin/users', val);
|
|
18
|
+
Object.assign(user, result);
|
|
19
|
+
toast('success', text('page.admin.toast.user_updated'));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
toast('error', e);
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
</script>
|
|
21
25
|
|
|
@@ -78,8 +82,13 @@
|
|
|
78
82
|
{/if}
|
|
79
83
|
<button
|
|
80
84
|
onclick={async () => {
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
try {
|
|
86
|
+
const { isSuspended } = await fetchAPI('PATCH', 'admin/users', { isSuspended: !user.isSuspended, id: user.id });
|
|
87
|
+
user.isSuspended = isSuspended;
|
|
88
|
+
await toast('success', text(`page.admin.toast.${isSuspended ? 'suspended' : 'unsuspended'}`));
|
|
89
|
+
} catch (e) {
|
|
90
|
+
await toast('error', e);
|
|
91
|
+
}
|
|
83
92
|
}}>{user.isSuspended ? text('page.admin.users.unsuspend') : text('page.admin.users.suspend')}</button
|
|
84
93
|
>
|
|
85
94
|
</div>
|