We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 49fd688 commit e9d2145Copy full SHA for e9d2145
packages/plugin-backend/src/data.ts
@@ -25,12 +25,18 @@ export const DataSet = (
25
On.backend().PluginLoadUser(emitter, [
26
async (id: string) => {
27
// TODO: backend types
28
- await ofetch(`/api/user/${id}`, {
29
- method: 'POST',
+ const { payload } = await ofetch(`/api/user/${id}`, {
+ method: 'GET',
30
async onRequestError() {
31
hooks.toast.error(hooks.i18n.t('toast.user.fail'))
32
},
33
})
34
+
35
+ if (payload) {
36
+ stores.AUTH.user = payload
37
38
+ hooks.toast.success(hooks.i18n.t('toast.user.success'))
39
+ }
40
41
() => {},
42
])
0 commit comments