mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
changePAssword query
This commit is contained in:
parent
9e15575855
commit
2a258319e7
@ -25,3 +25,15 @@ export class UnsecureLoginArgs {
|
||||
@Field(() => String)
|
||||
password: string
|
||||
}
|
||||
|
||||
@ArgsType()
|
||||
export class ChangePasswordArgs {
|
||||
@Field(() => Number)
|
||||
sessionId: number
|
||||
|
||||
@Field(() => String)
|
||||
email: string
|
||||
|
||||
@Field(() => String)
|
||||
password: string
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { Resolver, Query, /* Mutation, */ Args, Arg } from 'type-graphql'
|
||||
import CONFIG from '../../config'
|
||||
import { LoginResponse, LoginViaVerificationCode } from '../models/User'
|
||||
import { UnsecureLoginArgs } from '../inputs/LoginUserInput'
|
||||
import { UnsecureLoginArgs, ChangePasswordArgs } from '../inputs/LoginUserInput'
|
||||
import { apiPost, apiGet } from '../../apis/loginAPI'
|
||||
|
||||
@Resolver()
|
||||
@ -84,4 +84,18 @@ export class UserResolver {
|
||||
}
|
||||
return result.result
|
||||
}
|
||||
|
||||
@Query(() => String)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async changePassword(@Args() { sessionId, email, password }: ChangePasswordArgs): Promise<any> {
|
||||
const payload = {
|
||||
session_id: sessionId,
|
||||
email,
|
||||
password,
|
||||
}
|
||||
const result = await apiPost(CONFIG.LOGIN_API_URL + 'resetPassword', payload)
|
||||
console.log(result)
|
||||
if (result.success) return result.result.data.state
|
||||
return result.result
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user