Change the email returned by Headscale API to username
Change the email returned by Headscale API to username for PreAuthKey frontend.
This commit is contained in:
parent
23fd2bbda2
commit
63d6353d38
@ -26,10 +26,17 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|||||||
const qp = new URLSearchParams();
|
const qp = new URLSearchParams();
|
||||||
qp.set('user', user.name);
|
qp.set('user', user.name);
|
||||||
|
|
||||||
return pull<{ preAuthKeys: PreAuthKey[] }>(
|
var result = pull<{ preAuthKeys: PreAuthKey[] }>(
|
||||||
`v1/preauthkey?${qp.toString()}`,
|
`v1/preauthkey?${qp.toString()}`,
|
||||||
session.get('hsApiKey')!,
|
session.get('hsApiKey')!,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Change the email returned by Headscale API to username
|
||||||
|
result.forEach((preauthkey_item, index) => {
|
||||||
|
preauthkey_item.user = user;
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user