Files
softplayer-web/lib/api/grpc/accounts.dart
Nikolai Rodionov 7b6b568950 Remove a lot and start from scratch
Signed-off-by: Nikolai Rodionov <nrodionov@eos-uptrade.de>
2026-04-27 12:53:52 +02:00

43 lines
1.0 KiB
Dart

import 'package:grpc/grpc_web.dart';
import 'package:softplayer_dart_proto/src/accounts/v1/accounts_v1.pb.dart';
import 'package:softplayer_dart_proto/src/accounts/v1/accounts_v1.pbgrpc.dart';
class AccountLocalData {
AccountLocalData({
required this.uuid,
required this.token,
});
String uuid;
String token;
}
class AccountsGrpc {
final GrpcWebClientChannel channel;
late AccountsServiceClient accountsStub;
AccountsGrpc({
required this.channel,
});
void init() {
accountsStub = AccountsServiceClient(channel);
}
Future<AccountLocalData> signUp(
String username, String email, String password) async {
final request = SignUpRequest(
data: AccountData(
name: username,
email: email,
),
password: AccountPassword(
password: password,
));
try {
final response = await accountsStub.signUp(request);
return AccountLocalData(uuid: "test", token: "test");
} catch (e) {
rethrow;
}
}
}