refactor(frontend): adapt to RESTful API routes
This commit is contained in:
@@ -17,7 +17,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
final refreshToken = await _repository.getRefreshToken();
|
||||
if (refreshToken != null) {
|
||||
try {
|
||||
final response = await _repository.refresh(refreshToken);
|
||||
final response = await _repository.refreshSession(refreshToken);
|
||||
emit(
|
||||
AuthAuthenticated(
|
||||
user: AuthUser(id: response.user.id, email: response.user.email),
|
||||
@@ -25,7 +25,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
);
|
||||
return;
|
||||
} catch (_) {
|
||||
await _repository.logout();
|
||||
await _repository.deleteSession();
|
||||
}
|
||||
}
|
||||
emit(AuthUnauthenticated());
|
||||
@@ -39,7 +39,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
AuthLoggedOut event,
|
||||
Emitter<AuthState> emit,
|
||||
) async {
|
||||
await _repository.logout();
|
||||
await _repository.deleteSession();
|
||||
emit(AuthUnauthenticated());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class LoginCubit extends Cubit<LoginState> {
|
||||
emit(state.copyWith(status: FormzSubmissionStatus.inProgress));
|
||||
|
||||
try {
|
||||
final response = await _repository.login(
|
||||
final response = await _repository.createSession(
|
||||
LoginRequest(email: state.email.value, password: state.password.value),
|
||||
);
|
||||
emit(state.copyWith(status: FormzSubmissionStatus.success));
|
||||
|
||||
@@ -99,7 +99,7 @@ class RegisterCubit extends Cubit<RegisterState> {
|
||||
emit(state.copyWith(status: FormzSubmissionStatus.inProgress));
|
||||
|
||||
try {
|
||||
final response = await _repository.signupStart(
|
||||
final response = await _repository.createVerification(
|
||||
SignupStartRequest(
|
||||
username: state.username.value,
|
||||
email: state.email.value,
|
||||
@@ -132,7 +132,7 @@ class RegisterCubit extends Cubit<RegisterState> {
|
||||
emit(state.copyWith(status: FormzSubmissionStatus.inProgress));
|
||||
|
||||
try {
|
||||
final response = await _repository.signupVerify(
|
||||
final response = await _repository.verifyVerification(
|
||||
SignupVerifyRequest(
|
||||
email: state.pendingEmail!,
|
||||
token: state.verificationCode.value,
|
||||
@@ -166,7 +166,7 @@ class RegisterCubit extends Cubit<RegisterState> {
|
||||
emit(state.copyWith(status: FormzSubmissionStatus.inProgress));
|
||||
|
||||
try {
|
||||
await _repository.signupResend(
|
||||
await _repository.resendVerification(
|
||||
SignupResendRequest(email: state.pendingEmail!),
|
||||
);
|
||||
emit(
|
||||
@@ -197,7 +197,7 @@ class RegisterCubit extends Cubit<RegisterState> {
|
||||
);
|
||||
|
||||
try {
|
||||
final response = await _repository.signupStart(
|
||||
final response = await _repository.createVerification(
|
||||
SignupStartRequest(
|
||||
username: state.username.value,
|
||||
email: state.email.value,
|
||||
|
||||
Reference in New Issue
Block a user