Set Password Repo
This commit is contained in:
parent
c40f96fc88
commit
1a0c0cf49b
@ -0,0 +1,81 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/auth/auth.dart';
|
||||
|
||||
part 'set_password_form_event.dart';
|
||||
part 'set_password_form_state.dart';
|
||||
part 'set_password_form_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class SetPasswordFormBloc
|
||||
extends Bloc<SetPasswordFormEvent, SetPasswordFormState> {
|
||||
final IAuthRepository _repository;
|
||||
SetPasswordFormBloc(this._repository)
|
||||
: super(SetPasswordFormState.initial()) {
|
||||
on<SetPasswordFormEvent>(_onSetPasswordFormEvent);
|
||||
}
|
||||
|
||||
Future<void> _onSetPasswordFormEvent(
|
||||
SetPasswordFormEvent event,
|
||||
Emitter<SetPasswordFormState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
registrationTokenChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
registrationToken: e.registrationToken,
|
||||
failureOrSetPasswordOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
passwordChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
password: e.password,
|
||||
failureOrSetPasswordOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
confirmPasswordChanged: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
confirmPassword: e.confirmPassword,
|
||||
failureOrSetPasswordOption: none(),
|
||||
),
|
||||
);
|
||||
},
|
||||
submitted: (e) async {
|
||||
Either<AuthFailure, Login>? failureOrSetPassword;
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: true,
|
||||
failureOrSetPasswordOption: none(),
|
||||
),
|
||||
);
|
||||
|
||||
final registrationTokenValid = state.registrationToken.isNotEmpty;
|
||||
final passwordValid = state.password.isNotEmpty;
|
||||
final confirmPasswordValid = state.confirmPassword.isNotEmpty;
|
||||
|
||||
if (registrationTokenValid && passwordValid && confirmPasswordValid) {
|
||||
failureOrSetPassword = await _repository.setPassword(
|
||||
registrationToken: state.registrationToken,
|
||||
password: state.password,
|
||||
confirmPassword: state.confirmPassword,
|
||||
);
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSubmitting: false,
|
||||
failureOrSetPasswordOption: optionOf(failureOrSetPassword),
|
||||
),
|
||||
);
|
||||
}
|
||||
emit(state.copyWith(showErrorMessages: true, isSubmitting: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,980 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'set_password_form_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SetPasswordFormEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_ConfirmPasswordChanged value)
|
||||
confirmPasswordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SetPasswordFormEventCopyWith<$Res> {
|
||||
factory $SetPasswordFormEventCopyWith(
|
||||
SetPasswordFormEvent value,
|
||||
$Res Function(SetPasswordFormEvent) then,
|
||||
) = _$SetPasswordFormEventCopyWithImpl<$Res, SetPasswordFormEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SetPasswordFormEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends SetPasswordFormEvent
|
||||
>
|
||||
implements $SetPasswordFormEventCopyWith<$Res> {
|
||||
_$SetPasswordFormEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RegistrationTokenChangedImplCopyWith<$Res> {
|
||||
factory _$$RegistrationTokenChangedImplCopyWith(
|
||||
_$RegistrationTokenChangedImpl value,
|
||||
$Res Function(_$RegistrationTokenChangedImpl) then,
|
||||
) = __$$RegistrationTokenChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String registrationToken});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RegistrationTokenChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$SetPasswordFormEventCopyWithImpl<$Res, _$RegistrationTokenChangedImpl>
|
||||
implements _$$RegistrationTokenChangedImplCopyWith<$Res> {
|
||||
__$$RegistrationTokenChangedImplCopyWithImpl(
|
||||
_$RegistrationTokenChangedImpl _value,
|
||||
$Res Function(_$RegistrationTokenChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? registrationToken = null}) {
|
||||
return _then(
|
||||
_$RegistrationTokenChangedImpl(
|
||||
null == registrationToken
|
||||
? _value.registrationToken
|
||||
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RegistrationTokenChangedImpl implements _RegistrationTokenChanged {
|
||||
const _$RegistrationTokenChangedImpl(this.registrationToken);
|
||||
|
||||
@override
|
||||
final String registrationToken;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetPasswordFormEvent.registrationTokenChanged(registrationToken: $registrationToken)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RegistrationTokenChangedImpl &&
|
||||
(identical(other.registrationToken, registrationToken) ||
|
||||
other.registrationToken == registrationToken));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, registrationToken);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
|
||||
get copyWith =>
|
||||
__$$RegistrationTokenChangedImplCopyWithImpl<
|
||||
_$RegistrationTokenChangedImpl
|
||||
>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return registrationTokenChanged(registrationToken);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return registrationTokenChanged?.call(registrationToken);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (registrationTokenChanged != null) {
|
||||
return registrationTokenChanged(registrationToken);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_ConfirmPasswordChanged value)
|
||||
confirmPasswordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return registrationTokenChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return registrationTokenChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (registrationTokenChanged != null) {
|
||||
return registrationTokenChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RegistrationTokenChanged implements SetPasswordFormEvent {
|
||||
const factory _RegistrationTokenChanged(final String registrationToken) =
|
||||
_$RegistrationTokenChangedImpl;
|
||||
|
||||
String get registrationToken;
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RegistrationTokenChangedImplCopyWith<_$RegistrationTokenChangedImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PasswordChangedImplCopyWith<$Res> {
|
||||
factory _$$PasswordChangedImplCopyWith(
|
||||
_$PasswordChangedImpl value,
|
||||
$Res Function(_$PasswordChangedImpl) then,
|
||||
) = __$$PasswordChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String password});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PasswordChangedImplCopyWithImpl<$Res>
|
||||
extends _$SetPasswordFormEventCopyWithImpl<$Res, _$PasswordChangedImpl>
|
||||
implements _$$PasswordChangedImplCopyWith<$Res> {
|
||||
__$$PasswordChangedImplCopyWithImpl(
|
||||
_$PasswordChangedImpl _value,
|
||||
$Res Function(_$PasswordChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? password = null}) {
|
||||
return _then(
|
||||
_$PasswordChangedImpl(
|
||||
null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$PasswordChangedImpl implements _PasswordChanged {
|
||||
const _$PasswordChangedImpl(this.password);
|
||||
|
||||
@override
|
||||
final String password;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetPasswordFormEvent.passwordChanged(password: $password)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PasswordChangedImpl &&
|
||||
(identical(other.password, password) ||
|
||||
other.password == password));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, password);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PasswordChangedImplCopyWith<_$PasswordChangedImpl> get copyWith =>
|
||||
__$$PasswordChangedImplCopyWithImpl<_$PasswordChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return passwordChanged(password);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return passwordChanged?.call(password);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (passwordChanged != null) {
|
||||
return passwordChanged(password);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_ConfirmPasswordChanged value)
|
||||
confirmPasswordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return passwordChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return passwordChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (passwordChanged != null) {
|
||||
return passwordChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _PasswordChanged implements SetPasswordFormEvent {
|
||||
const factory _PasswordChanged(final String password) = _$PasswordChangedImpl;
|
||||
|
||||
String get password;
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PasswordChangedImplCopyWith<_$PasswordChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ConfirmPasswordChangedImplCopyWith<$Res> {
|
||||
factory _$$ConfirmPasswordChangedImplCopyWith(
|
||||
_$ConfirmPasswordChangedImpl value,
|
||||
$Res Function(_$ConfirmPasswordChangedImpl) then,
|
||||
) = __$$ConfirmPasswordChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String confirmPassword});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ConfirmPasswordChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$SetPasswordFormEventCopyWithImpl<$Res, _$ConfirmPasswordChangedImpl>
|
||||
implements _$$ConfirmPasswordChangedImplCopyWith<$Res> {
|
||||
__$$ConfirmPasswordChangedImplCopyWithImpl(
|
||||
_$ConfirmPasswordChangedImpl _value,
|
||||
$Res Function(_$ConfirmPasswordChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? confirmPassword = null}) {
|
||||
return _then(
|
||||
_$ConfirmPasswordChangedImpl(
|
||||
null == confirmPassword
|
||||
? _value.confirmPassword
|
||||
: confirmPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ConfirmPasswordChangedImpl implements _ConfirmPasswordChanged {
|
||||
const _$ConfirmPasswordChangedImpl(this.confirmPassword);
|
||||
|
||||
@override
|
||||
final String confirmPassword;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetPasswordFormEvent.confirmPasswordChanged(confirmPassword: $confirmPassword)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ConfirmPasswordChangedImpl &&
|
||||
(identical(other.confirmPassword, confirmPassword) ||
|
||||
other.confirmPassword == confirmPassword));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, confirmPassword);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ConfirmPasswordChangedImplCopyWith<_$ConfirmPasswordChangedImpl>
|
||||
get copyWith =>
|
||||
__$$ConfirmPasswordChangedImplCopyWithImpl<_$ConfirmPasswordChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return confirmPasswordChanged(confirmPassword);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return confirmPasswordChanged?.call(confirmPassword);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (confirmPasswordChanged != null) {
|
||||
return confirmPasswordChanged(confirmPassword);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_ConfirmPasswordChanged value)
|
||||
confirmPasswordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return confirmPasswordChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return confirmPasswordChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (confirmPasswordChanged != null) {
|
||||
return confirmPasswordChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ConfirmPasswordChanged implements SetPasswordFormEvent {
|
||||
const factory _ConfirmPasswordChanged(final String confirmPassword) =
|
||||
_$ConfirmPasswordChangedImpl;
|
||||
|
||||
String get confirmPassword;
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ConfirmPasswordChangedImplCopyWith<_$ConfirmPasswordChangedImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SubmittedImplCopyWith<$Res> {
|
||||
factory _$$SubmittedImplCopyWith(
|
||||
_$SubmittedImpl value,
|
||||
$Res Function(_$SubmittedImpl) then,
|
||||
) = __$$SubmittedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SubmittedImplCopyWithImpl<$Res>
|
||||
extends _$SetPasswordFormEventCopyWithImpl<$Res, _$SubmittedImpl>
|
||||
implements _$$SubmittedImplCopyWith<$Res> {
|
||||
__$$SubmittedImplCopyWithImpl(
|
||||
_$SubmittedImpl _value,
|
||||
$Res Function(_$SubmittedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of SetPasswordFormEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SubmittedImpl implements _Submitted {
|
||||
const _$SubmittedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetPasswordFormEvent.submitted()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$SubmittedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(String registrationToken)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(String password) passwordChanged,
|
||||
required TResult Function(String confirmPassword) confirmPasswordChanged,
|
||||
required TResult Function() submitted,
|
||||
}) {
|
||||
return submitted();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult? Function(String password)? passwordChanged,
|
||||
TResult? Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult? Function()? submitted,
|
||||
}) {
|
||||
return submitted?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(String registrationToken)? registrationTokenChanged,
|
||||
TResult Function(String password)? passwordChanged,
|
||||
TResult Function(String confirmPassword)? confirmPasswordChanged,
|
||||
TResult Function()? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RegistrationTokenChanged value)
|
||||
registrationTokenChanged,
|
||||
required TResult Function(_PasswordChanged value) passwordChanged,
|
||||
required TResult Function(_ConfirmPasswordChanged value)
|
||||
confirmPasswordChanged,
|
||||
required TResult Function(_Submitted value) submitted,
|
||||
}) {
|
||||
return submitted(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RegistrationTokenChanged value)?
|
||||
registrationTokenChanged,
|
||||
TResult? Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult? Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult? Function(_Submitted value)? submitted,
|
||||
}) {
|
||||
return submitted?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RegistrationTokenChanged value)? registrationTokenChanged,
|
||||
TResult Function(_PasswordChanged value)? passwordChanged,
|
||||
TResult Function(_ConfirmPasswordChanged value)? confirmPasswordChanged,
|
||||
TResult Function(_Submitted value)? submitted,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (submitted != null) {
|
||||
return submitted(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Submitted implements SetPasswordFormEvent {
|
||||
const factory _Submitted() = _$SubmittedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SetPasswordFormState {
|
||||
String get registrationToken => throw _privateConstructorUsedError;
|
||||
String get password => throw _privateConstructorUsedError;
|
||||
String get confirmPassword => throw _privateConstructorUsedError;
|
||||
Option<Either<AuthFailure, Login>> get failureOrSetPasswordOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isSubmitting => throw _privateConstructorUsedError;
|
||||
bool get showErrorMessages => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of SetPasswordFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$SetPasswordFormStateCopyWith<SetPasswordFormState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SetPasswordFormStateCopyWith<$Res> {
|
||||
factory $SetPasswordFormStateCopyWith(
|
||||
SetPasswordFormState value,
|
||||
$Res Function(SetPasswordFormState) then,
|
||||
) = _$SetPasswordFormStateCopyWithImpl<$Res, SetPasswordFormState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String registrationToken,
|
||||
String password,
|
||||
String confirmPassword,
|
||||
Option<Either<AuthFailure, Login>> failureOrSetPasswordOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SetPasswordFormStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends SetPasswordFormState
|
||||
>
|
||||
implements $SetPasswordFormStateCopyWith<$Res> {
|
||||
_$SetPasswordFormStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of SetPasswordFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? registrationToken = null,
|
||||
Object? password = null,
|
||||
Object? confirmPassword = null,
|
||||
Object? failureOrSetPasswordOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
registrationToken: null == registrationToken
|
||||
? _value.registrationToken
|
||||
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
confirmPassword: null == confirmPassword
|
||||
? _value.confirmPassword
|
||||
: confirmPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrSetPasswordOption: null == failureOrSetPasswordOption
|
||||
? _value.failureOrSetPasswordOption
|
||||
: failureOrSetPasswordOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Login>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SetPasswordFormStateImplCopyWith<$Res>
|
||||
implements $SetPasswordFormStateCopyWith<$Res> {
|
||||
factory _$$SetPasswordFormStateImplCopyWith(
|
||||
_$SetPasswordFormStateImpl value,
|
||||
$Res Function(_$SetPasswordFormStateImpl) then,
|
||||
) = __$$SetPasswordFormStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String registrationToken,
|
||||
String password,
|
||||
String confirmPassword,
|
||||
Option<Either<AuthFailure, Login>> failureOrSetPasswordOption,
|
||||
bool isSubmitting,
|
||||
bool showErrorMessages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SetPasswordFormStateImplCopyWithImpl<$Res>
|
||||
extends _$SetPasswordFormStateCopyWithImpl<$Res, _$SetPasswordFormStateImpl>
|
||||
implements _$$SetPasswordFormStateImplCopyWith<$Res> {
|
||||
__$$SetPasswordFormStateImplCopyWithImpl(
|
||||
_$SetPasswordFormStateImpl _value,
|
||||
$Res Function(_$SetPasswordFormStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of SetPasswordFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? registrationToken = null,
|
||||
Object? password = null,
|
||||
Object? confirmPassword = null,
|
||||
Object? failureOrSetPasswordOption = null,
|
||||
Object? isSubmitting = null,
|
||||
Object? showErrorMessages = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$SetPasswordFormStateImpl(
|
||||
registrationToken: null == registrationToken
|
||||
? _value.registrationToken
|
||||
: registrationToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
confirmPassword: null == confirmPassword
|
||||
? _value.confirmPassword
|
||||
: confirmPassword // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
failureOrSetPasswordOption: null == failureOrSetPasswordOption
|
||||
? _value.failureOrSetPasswordOption
|
||||
: failureOrSetPasswordOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<Either<AuthFailure, Login>>,
|
||||
isSubmitting: null == isSubmitting
|
||||
? _value.isSubmitting
|
||||
: isSubmitting // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
showErrorMessages: null == showErrorMessages
|
||||
? _value.showErrorMessages
|
||||
: showErrorMessages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$SetPasswordFormStateImpl implements _SetPasswordFormState {
|
||||
const _$SetPasswordFormStateImpl({
|
||||
required this.registrationToken,
|
||||
required this.password,
|
||||
required this.confirmPassword,
|
||||
required this.failureOrSetPasswordOption,
|
||||
this.isSubmitting = false,
|
||||
this.showErrorMessages = false,
|
||||
});
|
||||
|
||||
@override
|
||||
final String registrationToken;
|
||||
@override
|
||||
final String password;
|
||||
@override
|
||||
final String confirmPassword;
|
||||
@override
|
||||
final Option<Either<AuthFailure, Login>> failureOrSetPasswordOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isSubmitting;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool showErrorMessages;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SetPasswordFormState(registrationToken: $registrationToken, password: $password, confirmPassword: $confirmPassword, failureOrSetPasswordOption: $failureOrSetPasswordOption, isSubmitting: $isSubmitting, showErrorMessages: $showErrorMessages)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SetPasswordFormStateImpl &&
|
||||
(identical(other.registrationToken, registrationToken) ||
|
||||
other.registrationToken == registrationToken) &&
|
||||
(identical(other.password, password) ||
|
||||
other.password == password) &&
|
||||
(identical(other.confirmPassword, confirmPassword) ||
|
||||
other.confirmPassword == confirmPassword) &&
|
||||
(identical(
|
||||
other.failureOrSetPasswordOption,
|
||||
failureOrSetPasswordOption,
|
||||
) ||
|
||||
other.failureOrSetPasswordOption ==
|
||||
failureOrSetPasswordOption) &&
|
||||
(identical(other.isSubmitting, isSubmitting) ||
|
||||
other.isSubmitting == isSubmitting) &&
|
||||
(identical(other.showErrorMessages, showErrorMessages) ||
|
||||
other.showErrorMessages == showErrorMessages));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
registrationToken,
|
||||
password,
|
||||
confirmPassword,
|
||||
failureOrSetPasswordOption,
|
||||
isSubmitting,
|
||||
showErrorMessages,
|
||||
);
|
||||
|
||||
/// Create a copy of SetPasswordFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SetPasswordFormStateImplCopyWith<_$SetPasswordFormStateImpl>
|
||||
get copyWith =>
|
||||
__$$SetPasswordFormStateImplCopyWithImpl<_$SetPasswordFormStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _SetPasswordFormState implements SetPasswordFormState {
|
||||
const factory _SetPasswordFormState({
|
||||
required final String registrationToken,
|
||||
required final String password,
|
||||
required final String confirmPassword,
|
||||
required final Option<Either<AuthFailure, Login>>
|
||||
failureOrSetPasswordOption,
|
||||
final bool isSubmitting,
|
||||
final bool showErrorMessages,
|
||||
}) = _$SetPasswordFormStateImpl;
|
||||
|
||||
@override
|
||||
String get registrationToken;
|
||||
@override
|
||||
String get password;
|
||||
@override
|
||||
String get confirmPassword;
|
||||
@override
|
||||
Option<Either<AuthFailure, Login>> get failureOrSetPasswordOption;
|
||||
@override
|
||||
bool get isSubmitting;
|
||||
@override
|
||||
bool get showErrorMessages;
|
||||
|
||||
/// Create a copy of SetPasswordFormState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$SetPasswordFormStateImplCopyWith<_$SetPasswordFormStateImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
part of 'set_password_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class SetPasswordFormEvent with _$SetPasswordFormEvent {
|
||||
const factory SetPasswordFormEvent.registrationTokenChanged(
|
||||
String registrationToken,
|
||||
) = _RegistrationTokenChanged;
|
||||
const factory SetPasswordFormEvent.passwordChanged(String password) =
|
||||
_PasswordChanged;
|
||||
const factory SetPasswordFormEvent.confirmPasswordChanged(
|
||||
String confirmPassword,
|
||||
) = _ConfirmPasswordChanged;
|
||||
const factory SetPasswordFormEvent.submitted() = _Submitted;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
part of 'set_password_form_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class SetPasswordFormState with _$SetPasswordFormState {
|
||||
const factory SetPasswordFormState({
|
||||
required String registrationToken,
|
||||
required String password,
|
||||
required String confirmPassword,
|
||||
required Option<Either<AuthFailure, Login>> failureOrSetPasswordOption,
|
||||
@Default(false) bool isSubmitting,
|
||||
@Default(false) bool showErrorMessages,
|
||||
}) = _SetPasswordFormState;
|
||||
|
||||
factory SetPasswordFormState.initial() => SetPasswordFormState(
|
||||
registrationToken: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
failureOrSetPasswordOption: none(),
|
||||
);
|
||||
}
|
||||
@ -2,4 +2,5 @@ class ApiPath {
|
||||
static String checkPhone = '/api/v1/customer-auth/check-phone';
|
||||
static String register = '/api/v1/customer-auth/register/start';
|
||||
static String verify = '/api/v1/customer-auth/register/verify-otp';
|
||||
static String setPassword = '/api/v1/customer-auth/register/set-password';
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ part 'auth.freezed.dart';
|
||||
part 'entities/check_phone_entity.dart';
|
||||
part 'entities/register_entity.dart';
|
||||
part 'entities/verify_entity.dart';
|
||||
part 'entities/login_entity.dart';
|
||||
part 'failures/auth_failure.dart';
|
||||
part 'repositories/i_auth_repository.dart';
|
||||
|
||||
|
||||
@ -598,6 +598,441 @@ abstract class _Verify implements Verify {
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Login {
|
||||
String get status => throw _privateConstructorUsedError;
|
||||
String get message => throw _privateConstructorUsedError;
|
||||
String get accessToken => throw _privateConstructorUsedError;
|
||||
String get refreshToken => throw _privateConstructorUsedError;
|
||||
User get user => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of Login
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$LoginCopyWith<Login> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LoginCopyWith<$Res> {
|
||||
factory $LoginCopyWith(Login value, $Res Function(Login) then) =
|
||||
_$LoginCopyWithImpl<$Res, Login>;
|
||||
@useResult
|
||||
$Res call({
|
||||
String status,
|
||||
String message,
|
||||
String accessToken,
|
||||
String refreshToken,
|
||||
User user,
|
||||
});
|
||||
|
||||
$UserCopyWith<$Res> get user;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LoginCopyWithImpl<$Res, $Val extends Login>
|
||||
implements $LoginCopyWith<$Res> {
|
||||
_$LoginCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of Login
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? status = null,
|
||||
Object? message = null,
|
||||
Object? accessToken = null,
|
||||
Object? refreshToken = null,
|
||||
Object? user = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
message: null == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
accessToken: null == accessToken
|
||||
? _value.accessToken
|
||||
: accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
user: null == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as User,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of Login
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$UserCopyWith<$Res> get user {
|
||||
return $UserCopyWith<$Res>(_value.user, (value) {
|
||||
return _then(_value.copyWith(user: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoginImplCopyWith<$Res> implements $LoginCopyWith<$Res> {
|
||||
factory _$$LoginImplCopyWith(
|
||||
_$LoginImpl value,
|
||||
$Res Function(_$LoginImpl) then,
|
||||
) = __$$LoginImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
String status,
|
||||
String message,
|
||||
String accessToken,
|
||||
String refreshToken,
|
||||
User user,
|
||||
});
|
||||
|
||||
@override
|
||||
$UserCopyWith<$Res> get user;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoginImplCopyWithImpl<$Res>
|
||||
extends _$LoginCopyWithImpl<$Res, _$LoginImpl>
|
||||
implements _$$LoginImplCopyWith<$Res> {
|
||||
__$$LoginImplCopyWithImpl(
|
||||
_$LoginImpl _value,
|
||||
$Res Function(_$LoginImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of Login
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? status = null,
|
||||
Object? message = null,
|
||||
Object? accessToken = null,
|
||||
Object? refreshToken = null,
|
||||
Object? user = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$LoginImpl(
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
message: null == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
accessToken: null == accessToken
|
||||
? _value.accessToken
|
||||
: accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
user: null == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as User,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$LoginImpl implements _Login {
|
||||
const _$LoginImpl({
|
||||
required this.status,
|
||||
required this.message,
|
||||
required this.accessToken,
|
||||
required this.refreshToken,
|
||||
required this.user,
|
||||
});
|
||||
|
||||
@override
|
||||
final String status;
|
||||
@override
|
||||
final String message;
|
||||
@override
|
||||
final String accessToken;
|
||||
@override
|
||||
final String refreshToken;
|
||||
@override
|
||||
final User user;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Login(status: $status, message: $message, accessToken: $accessToken, refreshToken: $refreshToken, user: $user)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoginImpl &&
|
||||
(identical(other.status, status) || other.status == status) &&
|
||||
(identical(other.message, message) || other.message == message) &&
|
||||
(identical(other.accessToken, accessToken) ||
|
||||
other.accessToken == accessToken) &&
|
||||
(identical(other.refreshToken, refreshToken) ||
|
||||
other.refreshToken == refreshToken) &&
|
||||
(identical(other.user, user) || other.user == user));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
status,
|
||||
message,
|
||||
accessToken,
|
||||
refreshToken,
|
||||
user,
|
||||
);
|
||||
|
||||
/// Create a copy of Login
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LoginImplCopyWith<_$LoginImpl> get copyWith =>
|
||||
__$$LoginImplCopyWithImpl<_$LoginImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _Login implements Login {
|
||||
const factory _Login({
|
||||
required final String status,
|
||||
required final String message,
|
||||
required final String accessToken,
|
||||
required final String refreshToken,
|
||||
required final User user,
|
||||
}) = _$LoginImpl;
|
||||
|
||||
@override
|
||||
String get status;
|
||||
@override
|
||||
String get message;
|
||||
@override
|
||||
String get accessToken;
|
||||
@override
|
||||
String get refreshToken;
|
||||
@override
|
||||
User get user;
|
||||
|
||||
/// Create a copy of Login
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LoginImplCopyWith<_$LoginImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$User {
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String get phoneNumber => throw _privateConstructorUsedError;
|
||||
String get birthDate => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$UserCopyWith<User> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UserCopyWith<$Res> {
|
||||
factory $UserCopyWith(User value, $Res Function(User) then) =
|
||||
_$UserCopyWithImpl<$Res, User>;
|
||||
@useResult
|
||||
$Res call({String id, String name, String phoneNumber, String birthDate});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UserCopyWithImpl<$Res, $Val extends User>
|
||||
implements $UserCopyWith<$Res> {
|
||||
_$UserCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? name = null,
|
||||
Object? phoneNumber = null,
|
||||
Object? birthDate = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
phoneNumber: null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
birthDate: null == birthDate
|
||||
? _value.birthDate
|
||||
: birthDate // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UserImplCopyWith<$Res> implements $UserCopyWith<$Res> {
|
||||
factory _$$UserImplCopyWith(
|
||||
_$UserImpl value,
|
||||
$Res Function(_$UserImpl) then,
|
||||
) = __$$UserImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String id, String name, String phoneNumber, String birthDate});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UserImplCopyWithImpl<$Res>
|
||||
extends _$UserCopyWithImpl<$Res, _$UserImpl>
|
||||
implements _$$UserImplCopyWith<$Res> {
|
||||
__$$UserImplCopyWithImpl(_$UserImpl _value, $Res Function(_$UserImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? name = null,
|
||||
Object? phoneNumber = null,
|
||||
Object? birthDate = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$UserImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
phoneNumber: null == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
birthDate: null == birthDate
|
||||
? _value.birthDate
|
||||
: birthDate // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$UserImpl implements _User {
|
||||
const _$UserImpl({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.phoneNumber,
|
||||
required this.birthDate,
|
||||
});
|
||||
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final String phoneNumber;
|
||||
@override
|
||||
final String birthDate;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'User(id: $id, name: $name, phoneNumber: $phoneNumber, birthDate: $birthDate)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UserImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.phoneNumber, phoneNumber) ||
|
||||
other.phoneNumber == phoneNumber) &&
|
||||
(identical(other.birthDate, birthDate) ||
|
||||
other.birthDate == birthDate));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, id, name, phoneNumber, birthDate);
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
|
||||
__$$UserImplCopyWithImpl<_$UserImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _User implements User {
|
||||
const factory _User({
|
||||
required final String id,
|
||||
required final String name,
|
||||
required final String phoneNumber,
|
||||
required final String birthDate,
|
||||
}) = _$UserImpl;
|
||||
|
||||
@override
|
||||
String get id;
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
String get phoneNumber;
|
||||
@override
|
||||
String get birthDate;
|
||||
|
||||
/// Create a copy of User
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$UserImplCopyWith<_$UserImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AuthFailure {
|
||||
@optionalTypeArgs
|
||||
|
||||
33
lib/domain/auth/entities/login_entity.dart
Normal file
33
lib/domain/auth/entities/login_entity.dart
Normal file
@ -0,0 +1,33 @@
|
||||
part of '../auth.dart';
|
||||
|
||||
@freezed
|
||||
class Login with _$Login {
|
||||
const factory Login({
|
||||
required String status,
|
||||
required String message,
|
||||
required String accessToken,
|
||||
required String refreshToken,
|
||||
required User user,
|
||||
}) = _Login;
|
||||
|
||||
factory Login.empty() => Login(
|
||||
status: '',
|
||||
message: '',
|
||||
accessToken: '',
|
||||
refreshToken: '',
|
||||
user: User.empty(),
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class User with _$User {
|
||||
const factory User({
|
||||
required String id,
|
||||
required String name,
|
||||
required String phoneNumber,
|
||||
required String birthDate,
|
||||
}) = _User;
|
||||
|
||||
factory User.empty() =>
|
||||
const User(id: '', name: '', phoneNumber: '', birthDate: '');
|
||||
}
|
||||
@ -15,4 +15,10 @@ abstract class IAuthRepository {
|
||||
required String registrationToken,
|
||||
required String otpCode,
|
||||
});
|
||||
|
||||
Future<Either<AuthFailure, Login>> setPassword({
|
||||
required String registrationToken,
|
||||
required String password,
|
||||
required String confirmPassword,
|
||||
});
|
||||
}
|
||||
|
||||
@ -8,3 +8,4 @@ part 'auth_dtos.g.dart';
|
||||
part 'dto/check_phone_dto.dart';
|
||||
part 'dto/register_dto.dart';
|
||||
part 'dto/verify_dto.dart';
|
||||
part 'dto/login_dto.dart';
|
||||
|
||||
@ -1248,3 +1248,700 @@ abstract class _VerifyDataDto implements VerifyDataDto {
|
||||
_$$VerifyDataDtoImplCopyWith<_$VerifyDataDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
LoginDto _$LoginDtoFromJson(Map<String, dynamic> json) {
|
||||
return _LoginDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LoginDto {
|
||||
@JsonKey(name: 'status')
|
||||
String? get status => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'message')
|
||||
String? get message => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'data')
|
||||
LoginDataDto? get data => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this LoginDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of LoginDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$LoginDtoCopyWith<LoginDto> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LoginDtoCopyWith<$Res> {
|
||||
factory $LoginDtoCopyWith(LoginDto value, $Res Function(LoginDto) then) =
|
||||
_$LoginDtoCopyWithImpl<$Res, LoginDto>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'status') String? status,
|
||||
@JsonKey(name: 'message') String? message,
|
||||
@JsonKey(name: 'data') LoginDataDto? data,
|
||||
});
|
||||
|
||||
$LoginDataDtoCopyWith<$Res>? get data;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LoginDtoCopyWithImpl<$Res, $Val extends LoginDto>
|
||||
implements $LoginDtoCopyWith<$Res> {
|
||||
_$LoginDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LoginDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? status = freezed,
|
||||
Object? message = freezed,
|
||||
Object? data = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
status: freezed == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
message: freezed == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
data: freezed == data
|
||||
? _value.data
|
||||
: data // ignore: cast_nullable_to_non_nullable
|
||||
as LoginDataDto?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of LoginDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$LoginDataDtoCopyWith<$Res>? get data {
|
||||
if (_value.data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $LoginDataDtoCopyWith<$Res>(_value.data!, (value) {
|
||||
return _then(_value.copyWith(data: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoginDtoImplCopyWith<$Res>
|
||||
implements $LoginDtoCopyWith<$Res> {
|
||||
factory _$$LoginDtoImplCopyWith(
|
||||
_$LoginDtoImpl value,
|
||||
$Res Function(_$LoginDtoImpl) then,
|
||||
) = __$$LoginDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'status') String? status,
|
||||
@JsonKey(name: 'message') String? message,
|
||||
@JsonKey(name: 'data') LoginDataDto? data,
|
||||
});
|
||||
|
||||
@override
|
||||
$LoginDataDtoCopyWith<$Res>? get data;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoginDtoImplCopyWithImpl<$Res>
|
||||
extends _$LoginDtoCopyWithImpl<$Res, _$LoginDtoImpl>
|
||||
implements _$$LoginDtoImplCopyWith<$Res> {
|
||||
__$$LoginDtoImplCopyWithImpl(
|
||||
_$LoginDtoImpl _value,
|
||||
$Res Function(_$LoginDtoImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? status = freezed,
|
||||
Object? message = freezed,
|
||||
Object? data = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$LoginDtoImpl(
|
||||
status: freezed == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
message: freezed == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
data: freezed == data
|
||||
? _value.data
|
||||
: data // ignore: cast_nullable_to_non_nullable
|
||||
as LoginDataDto?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LoginDtoImpl extends _LoginDto {
|
||||
const _$LoginDtoImpl({
|
||||
@JsonKey(name: 'status') this.status,
|
||||
@JsonKey(name: 'message') this.message,
|
||||
@JsonKey(name: 'data') this.data,
|
||||
}) : super._();
|
||||
|
||||
factory _$LoginDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LoginDtoImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'status')
|
||||
final String? status;
|
||||
@override
|
||||
@JsonKey(name: 'message')
|
||||
final String? message;
|
||||
@override
|
||||
@JsonKey(name: 'data')
|
||||
final LoginDataDto? data;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginDto(status: $status, message: $message, data: $data)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoginDtoImpl &&
|
||||
(identical(other.status, status) || other.status == status) &&
|
||||
(identical(other.message, message) || other.message == message) &&
|
||||
(identical(other.data, data) || other.data == data));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, status, message, data);
|
||||
|
||||
/// Create a copy of LoginDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LoginDtoImplCopyWith<_$LoginDtoImpl> get copyWith =>
|
||||
__$$LoginDtoImplCopyWithImpl<_$LoginDtoImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LoginDtoImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LoginDto extends LoginDto {
|
||||
const factory _LoginDto({
|
||||
@JsonKey(name: 'status') final String? status,
|
||||
@JsonKey(name: 'message') final String? message,
|
||||
@JsonKey(name: 'data') final LoginDataDto? data,
|
||||
}) = _$LoginDtoImpl;
|
||||
const _LoginDto._() : super._();
|
||||
|
||||
factory _LoginDto.fromJson(Map<String, dynamic> json) =
|
||||
_$LoginDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'status')
|
||||
String? get status;
|
||||
@override
|
||||
@JsonKey(name: 'message')
|
||||
String? get message;
|
||||
@override
|
||||
@JsonKey(name: 'data')
|
||||
LoginDataDto? get data;
|
||||
|
||||
/// Create a copy of LoginDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LoginDtoImplCopyWith<_$LoginDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
LoginDataDto _$LoginDataDtoFromJson(Map<String, dynamic> json) {
|
||||
return _LoginDataDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LoginDataDto {
|
||||
@JsonKey(name: 'access_token')
|
||||
String? get accessToken => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String? get refreshToken => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'user')
|
||||
UserDto? get user => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this LoginDataDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of LoginDataDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$LoginDataDtoCopyWith<LoginDataDto> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LoginDataDtoCopyWith<$Res> {
|
||||
factory $LoginDataDtoCopyWith(
|
||||
LoginDataDto value,
|
||||
$Res Function(LoginDataDto) then,
|
||||
) = _$LoginDataDtoCopyWithImpl<$Res, LoginDataDto>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'access_token') String? accessToken,
|
||||
@JsonKey(name: 'refresh_token') String? refreshToken,
|
||||
@JsonKey(name: 'user') UserDto? user,
|
||||
});
|
||||
|
||||
$UserDtoCopyWith<$Res>? get user;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LoginDataDtoCopyWithImpl<$Res, $Val extends LoginDataDto>
|
||||
implements $LoginDataDtoCopyWith<$Res> {
|
||||
_$LoginDataDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LoginDataDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? accessToken = freezed,
|
||||
Object? refreshToken = freezed,
|
||||
Object? user = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
accessToken: freezed == accessToken
|
||||
? _value.accessToken
|
||||
: accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
refreshToken: freezed == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
user: freezed == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as UserDto?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of LoginDataDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$UserDtoCopyWith<$Res>? get user {
|
||||
if (_value.user == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $UserDtoCopyWith<$Res>(_value.user!, (value) {
|
||||
return _then(_value.copyWith(user: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoginDataDtoImplCopyWith<$Res>
|
||||
implements $LoginDataDtoCopyWith<$Res> {
|
||||
factory _$$LoginDataDtoImplCopyWith(
|
||||
_$LoginDataDtoImpl value,
|
||||
$Res Function(_$LoginDataDtoImpl) then,
|
||||
) = __$$LoginDataDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'access_token') String? accessToken,
|
||||
@JsonKey(name: 'refresh_token') String? refreshToken,
|
||||
@JsonKey(name: 'user') UserDto? user,
|
||||
});
|
||||
|
||||
@override
|
||||
$UserDtoCopyWith<$Res>? get user;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoginDataDtoImplCopyWithImpl<$Res>
|
||||
extends _$LoginDataDtoCopyWithImpl<$Res, _$LoginDataDtoImpl>
|
||||
implements _$$LoginDataDtoImplCopyWith<$Res> {
|
||||
__$$LoginDataDtoImplCopyWithImpl(
|
||||
_$LoginDataDtoImpl _value,
|
||||
$Res Function(_$LoginDataDtoImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginDataDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? accessToken = freezed,
|
||||
Object? refreshToken = freezed,
|
||||
Object? user = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$LoginDataDtoImpl(
|
||||
accessToken: freezed == accessToken
|
||||
? _value.accessToken
|
||||
: accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
refreshToken: freezed == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
user: freezed == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as UserDto?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LoginDataDtoImpl implements _LoginDataDto {
|
||||
const _$LoginDataDtoImpl({
|
||||
@JsonKey(name: 'access_token') this.accessToken,
|
||||
@JsonKey(name: 'refresh_token') this.refreshToken,
|
||||
@JsonKey(name: 'user') this.user,
|
||||
});
|
||||
|
||||
factory _$LoginDataDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LoginDataDtoImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'access_token')
|
||||
final String? accessToken;
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
final String? refreshToken;
|
||||
@override
|
||||
@JsonKey(name: 'user')
|
||||
final UserDto? user;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginDataDto(accessToken: $accessToken, refreshToken: $refreshToken, user: $user)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoginDataDtoImpl &&
|
||||
(identical(other.accessToken, accessToken) ||
|
||||
other.accessToken == accessToken) &&
|
||||
(identical(other.refreshToken, refreshToken) ||
|
||||
other.refreshToken == refreshToken) &&
|
||||
(identical(other.user, user) || other.user == user));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, accessToken, refreshToken, user);
|
||||
|
||||
/// Create a copy of LoginDataDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LoginDataDtoImplCopyWith<_$LoginDataDtoImpl> get copyWith =>
|
||||
__$$LoginDataDtoImplCopyWithImpl<_$LoginDataDtoImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LoginDataDtoImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LoginDataDto implements LoginDataDto {
|
||||
const factory _LoginDataDto({
|
||||
@JsonKey(name: 'access_token') final String? accessToken,
|
||||
@JsonKey(name: 'refresh_token') final String? refreshToken,
|
||||
@JsonKey(name: 'user') final UserDto? user,
|
||||
}) = _$LoginDataDtoImpl;
|
||||
|
||||
factory _LoginDataDto.fromJson(Map<String, dynamic> json) =
|
||||
_$LoginDataDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'access_token')
|
||||
String? get accessToken;
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String? get refreshToken;
|
||||
@override
|
||||
@JsonKey(name: 'user')
|
||||
UserDto? get user;
|
||||
|
||||
/// Create a copy of LoginDataDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LoginDataDtoImplCopyWith<_$LoginDataDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
UserDto _$UserDtoFromJson(Map<String, dynamic> json) {
|
||||
return _UserDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UserDto {
|
||||
@JsonKey(name: 'id')
|
||||
String? get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'name')
|
||||
String? get name => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'phone_number')
|
||||
String? get phoneNumber => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'birth_date')
|
||||
String? get birthDate => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this UserDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$UserDtoCopyWith<UserDto> get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $UserDtoCopyWith<$Res> {
|
||||
factory $UserDtoCopyWith(UserDto value, $Res Function(UserDto) then) =
|
||||
_$UserDtoCopyWithImpl<$Res, UserDto>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'id') String? id,
|
||||
@JsonKey(name: 'name') String? name,
|
||||
@JsonKey(name: 'phone_number') String? phoneNumber,
|
||||
@JsonKey(name: 'birth_date') String? birthDate,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$UserDtoCopyWithImpl<$Res, $Val extends UserDto>
|
||||
implements $UserDtoCopyWith<$Res> {
|
||||
_$UserDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = freezed,
|
||||
Object? name = freezed,
|
||||
Object? phoneNumber = freezed,
|
||||
Object? birthDate = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
name: freezed == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
phoneNumber: freezed == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
birthDate: freezed == birthDate
|
||||
? _value.birthDate
|
||||
: birthDate // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$UserDtoImplCopyWith<$Res> implements $UserDtoCopyWith<$Res> {
|
||||
factory _$$UserDtoImplCopyWith(
|
||||
_$UserDtoImpl value,
|
||||
$Res Function(_$UserDtoImpl) then,
|
||||
) = __$$UserDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: 'id') String? id,
|
||||
@JsonKey(name: 'name') String? name,
|
||||
@JsonKey(name: 'phone_number') String? phoneNumber,
|
||||
@JsonKey(name: 'birth_date') String? birthDate,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$UserDtoImplCopyWithImpl<$Res>
|
||||
extends _$UserDtoCopyWithImpl<$Res, _$UserDtoImpl>
|
||||
implements _$$UserDtoImplCopyWith<$Res> {
|
||||
__$$UserDtoImplCopyWithImpl(
|
||||
_$UserDtoImpl _value,
|
||||
$Res Function(_$UserDtoImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = freezed,
|
||||
Object? name = freezed,
|
||||
Object? phoneNumber = freezed,
|
||||
Object? birthDate = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$UserDtoImpl(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
name: freezed == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
phoneNumber: freezed == phoneNumber
|
||||
? _value.phoneNumber
|
||||
: phoneNumber // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
birthDate: freezed == birthDate
|
||||
? _value.birthDate
|
||||
: birthDate // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$UserDtoImpl extends _UserDto {
|
||||
const _$UserDtoImpl({
|
||||
@JsonKey(name: 'id') this.id,
|
||||
@JsonKey(name: 'name') this.name,
|
||||
@JsonKey(name: 'phone_number') this.phoneNumber,
|
||||
@JsonKey(name: 'birth_date') this.birthDate,
|
||||
}) : super._();
|
||||
|
||||
factory _$UserDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$UserDtoImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'id')
|
||||
final String? id;
|
||||
@override
|
||||
@JsonKey(name: 'name')
|
||||
final String? name;
|
||||
@override
|
||||
@JsonKey(name: 'phone_number')
|
||||
final String? phoneNumber;
|
||||
@override
|
||||
@JsonKey(name: 'birth_date')
|
||||
final String? birthDate;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserDto(id: $id, name: $name, phoneNumber: $phoneNumber, birthDate: $birthDate)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$UserDtoImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.phoneNumber, phoneNumber) ||
|
||||
other.phoneNumber == phoneNumber) &&
|
||||
(identical(other.birthDate, birthDate) ||
|
||||
other.birthDate == birthDate));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, id, name, phoneNumber, birthDate);
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$UserDtoImplCopyWith<_$UserDtoImpl> get copyWith =>
|
||||
__$$UserDtoImplCopyWithImpl<_$UserDtoImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$UserDtoImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _UserDto extends UserDto {
|
||||
const factory _UserDto({
|
||||
@JsonKey(name: 'id') final String? id,
|
||||
@JsonKey(name: 'name') final String? name,
|
||||
@JsonKey(name: 'phone_number') final String? phoneNumber,
|
||||
@JsonKey(name: 'birth_date') final String? birthDate,
|
||||
}) = _$UserDtoImpl;
|
||||
const _UserDto._() : super._();
|
||||
|
||||
factory _UserDto.fromJson(Map<String, dynamic> json) = _$UserDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'id')
|
||||
String? get id;
|
||||
@override
|
||||
@JsonKey(name: 'name')
|
||||
String? get name;
|
||||
@override
|
||||
@JsonKey(name: 'phone_number')
|
||||
String? get phoneNumber;
|
||||
@override
|
||||
@JsonKey(name: 'birth_date')
|
||||
String? get birthDate;
|
||||
|
||||
/// Create a copy of UserDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$UserDtoImplCopyWith<_$UserDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
@ -85,3 +85,51 @@ _$VerifyDataDtoImpl _$$VerifyDataDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
|
||||
Map<String, dynamic> _$$VerifyDataDtoImplToJson(_$VerifyDataDtoImpl instance) =>
|
||||
<String, dynamic>{'registration_token': instance.registrationToken};
|
||||
|
||||
_$LoginDtoImpl _$$LoginDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$LoginDtoImpl(
|
||||
status: json['status'] as String?,
|
||||
message: json['message'] as String?,
|
||||
data: json['data'] == null
|
||||
? null
|
||||
: LoginDataDto.fromJson(json['data'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LoginDtoImplToJson(_$LoginDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'status': instance.status,
|
||||
'message': instance.message,
|
||||
'data': instance.data,
|
||||
};
|
||||
|
||||
_$LoginDataDtoImpl _$$LoginDataDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$LoginDataDtoImpl(
|
||||
accessToken: json['access_token'] as String?,
|
||||
refreshToken: json['refresh_token'] as String?,
|
||||
user: json['user'] == null
|
||||
? null
|
||||
: UserDto.fromJson(json['user'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LoginDataDtoImplToJson(_$LoginDataDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'access_token': instance.accessToken,
|
||||
'refresh_token': instance.refreshToken,
|
||||
'user': instance.user,
|
||||
};
|
||||
|
||||
_$UserDtoImpl _$$UserDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$UserDtoImpl(
|
||||
id: json['id'] as String?,
|
||||
name: json['name'] as String?,
|
||||
phoneNumber: json['phone_number'] as String?,
|
||||
birthDate: json['birth_date'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$UserDtoImplToJson(_$UserDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'phone_number': instance.phoneNumber,
|
||||
'birth_date': instance.birthDate,
|
||||
};
|
||||
|
||||
@ -136,4 +136,51 @@ class AuthRemoteDataProvider {
|
||||
return DC.error(AuthFailure.serverError(e));
|
||||
}
|
||||
}
|
||||
|
||||
Future<DC<AuthFailure, LoginDto>> setPassword({
|
||||
required String registrationToken,
|
||||
required String password,
|
||||
required String confirmPassword,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _apiClient.post(
|
||||
ApiPath.setPassword,
|
||||
data: {
|
||||
'registration_token': registrationToken,
|
||||
'password': password,
|
||||
'confirm_password': confirmPassword,
|
||||
},
|
||||
);
|
||||
|
||||
if (response.data['success'] == false) {
|
||||
if ((response.data['errors'] as List).isNotEmpty) {
|
||||
if (response.data['errors'][0]['code'] == "900") {
|
||||
return DC.error(
|
||||
AuthFailure.dynamicErrorMessage(
|
||||
'Invalid Registration, Lakukan kembali dari awal',
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return DC.error(
|
||||
AuthFailure.dynamicErrorMessage(
|
||||
'Terjadi kesalahan coba lagi nanti',
|
||||
),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return DC.error(
|
||||
AuthFailure.dynamicErrorMessage(
|
||||
'Terjadi kesalahan coba lagi nanti',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final dto = LoginDto.fromJson(response.data['data']);
|
||||
return DC.data(dto);
|
||||
} on ApiFailure catch (e, s) {
|
||||
log('setPassword', name: _logName, error: e, stackTrace: s);
|
||||
return DC.error(AuthFailure.serverError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
58
lib/infrastructure/auth/dto/login_dto.dart
Normal file
58
lib/infrastructure/auth/dto/login_dto.dart
Normal file
@ -0,0 +1,58 @@
|
||||
part of '../auth_dtos.dart';
|
||||
|
||||
@freezed
|
||||
class LoginDto with _$LoginDto {
|
||||
const factory LoginDto({
|
||||
@JsonKey(name: 'status') String? status,
|
||||
@JsonKey(name: 'message') String? message,
|
||||
@JsonKey(name: 'data') LoginDataDto? data,
|
||||
}) = _LoginDto;
|
||||
|
||||
factory LoginDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$LoginDtoFromJson(json);
|
||||
|
||||
const LoginDto._();
|
||||
|
||||
/// mapping ke domain
|
||||
Login toDomain() => Login(
|
||||
status: status ?? '',
|
||||
message: message ?? '',
|
||||
accessToken: data?.accessToken ?? '',
|
||||
refreshToken: data?.refreshToken ?? '',
|
||||
user: data?.user?.toDomain() ?? User.empty(),
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class LoginDataDto with _$LoginDataDto {
|
||||
const factory LoginDataDto({
|
||||
@JsonKey(name: 'access_token') String? accessToken,
|
||||
@JsonKey(name: 'refresh_token') String? refreshToken,
|
||||
@JsonKey(name: 'user') UserDto? user,
|
||||
}) = _LoginDataDto;
|
||||
|
||||
factory LoginDataDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$LoginDataDtoFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class UserDto with _$UserDto {
|
||||
const factory UserDto({
|
||||
@JsonKey(name: 'id') String? id,
|
||||
@JsonKey(name: 'name') String? name,
|
||||
@JsonKey(name: 'phone_number') String? phoneNumber,
|
||||
@JsonKey(name: 'birth_date') String? birthDate,
|
||||
}) = _UserDto;
|
||||
|
||||
factory UserDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$UserDtoFromJson(json);
|
||||
|
||||
const UserDto._();
|
||||
|
||||
User toDomain() => User(
|
||||
id: id ?? '',
|
||||
name: name ?? '',
|
||||
phoneNumber: phoneNumber ?? '',
|
||||
birthDate: birthDate ?? '',
|
||||
);
|
||||
}
|
||||
@ -85,4 +85,30 @@ class AuthRepository implements IAuthRepository {
|
||||
return left(const AuthFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<AuthFailure, Login>> setPassword({
|
||||
required String registrationToken,
|
||||
required String password,
|
||||
required String confirmPassword,
|
||||
}) async {
|
||||
try {
|
||||
final result = await _remoteDataProvider.setPassword(
|
||||
registrationToken: registrationToken,
|
||||
password: password,
|
||||
confirmPassword: confirmPassword,
|
||||
);
|
||||
|
||||
if (result.hasError) {
|
||||
return left(result.error!);
|
||||
}
|
||||
|
||||
final auth = result.data!.toDomain();
|
||||
|
||||
return right(auth);
|
||||
} catch (e, s) {
|
||||
log('setPasswordError', name: _logName, error: e, stackTrace: s);
|
||||
return left(const AuthFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,8 @@ import 'package:enaklo/application/auth/check_phone_form/check_phone_form_bloc.d
|
||||
as _i869;
|
||||
import 'package:enaklo/application/auth/register_form/register_form_bloc.dart'
|
||||
as _i260;
|
||||
import 'package:enaklo/application/auth/set_password/set_password_form_bloc.dart'
|
||||
as _i174;
|
||||
import 'package:enaklo/application/auth/verify_form/verify_form_bloc.dart'
|
||||
as _i521;
|
||||
import 'package:enaklo/common/api/api_client.dart' as _i842;
|
||||
@ -78,6 +80,9 @@ extension GetItInjectableX on _i174.GetIt {
|
||||
gh.factory<_i521.VerifyFormBloc>(
|
||||
() => _i521.VerifyFormBloc(gh<_i995.IAuthRepository>()),
|
||||
);
|
||||
gh.factory<_i174.SetPasswordFormBloc>(
|
||||
() => _i174.SetPasswordFormBloc(gh<_i995.IAuthRepository>()),
|
||||
);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user