mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-08-31 04:57:35 -05:00
20 lines
602 B
TypeScript
20 lines
602 B
TypeScript
import { ResetPasswordSchema } from '~~/shared/api-types';
|
|
|
|
export default defineEventHandler(async (event): Promise<void> => {
|
|
const body = await readZodBody(event, ResetPasswordSchema);
|
|
const apiFetch = useHttpApi(event);
|
|
|
|
// The GRPC version requires a login token, which the user doesnt have when resetting password, so we're using the HTTP api
|
|
await apiFetch('/v1/reset-password', {
|
|
method: 'POST',
|
|
body: JSON.stringify({
|
|
password: body.password,
|
|
password_confirm: body.passwordConfirm,
|
|
token: body.resetToken
|
|
}),
|
|
headers: {
|
|
'Content-type': 'application/json'
|
|
}
|
|
});
|
|
});
|