Get token
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import 'dart:html';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grpc/grpc_web.dart';
|
||||
import 'package:softplayer_web/api/grpc/accounts.dart';
|
||||
@ -25,7 +27,11 @@ class _SignInFormState extends State<SignInForm> {
|
||||
final password = passwordCtrl.text;
|
||||
widget.accountsGrpc
|
||||
.signIn(username, "", password)
|
||||
.then((value) => null)
|
||||
.then((rs) {
|
||||
window.localStorage["token"] = rs.token;
|
||||
window.localStorage["uuid"] = rs.uuid;
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
})
|
||||
.catchError((e) {
|
||||
GrpcError error = e;
|
||||
String msg;
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'dart:html';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:grpc/grpc_web.dart';
|
||||
import 'package:softplayer_web/api/grpc/accounts.dart';
|
||||
@ -32,7 +34,12 @@ class _SignUpFormState extends State<SignUpForm> {
|
||||
final email = emailCtrl.text;
|
||||
widget.accountsGrpc
|
||||
.signUp(username, email, password)
|
||||
.then((value) => null)
|
||||
.then((rs) {
|
||||
window.localStorage["token"] = rs.token;
|
||||
window.localStorage["uuid"] = rs.uuid;
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
})
|
||||
|
||||
.catchError((e) {
|
||||
GrpcError error = e;
|
||||
String msg;
|
||||
|
Reference in New Issue
Block a user