This commit is contained in:
erfan
2021-06-21 14:14:54 +04:30
parent 2c045f43f1
commit e2b8fab7d9
60 changed files with 4078 additions and 3928 deletions
+9 -8
View File
@@ -1,12 +1,13 @@
import 'dart:convert';
import 'dart:io';
import 'package:cssd/config/user.dart';
import 'package:flutter/material.dart';
import 'package:cssd/config/urls.dart';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
import '../config/urls.dart';
import '../config/user.dart';
class Auth with ChangeNotifier {
String _token;
DateTime _expiaryDate;
@@ -32,7 +33,7 @@ class Auth with ChangeNotifier {
Future<String> requestCode(String cellNumber) async {
final response = await http.post(
Url.requestResetPass,
Uri.parse(Url.requestResetPass),
body: {
'cell_number': cellNumber,
},
@@ -49,7 +50,7 @@ class Auth with ChangeNotifier {
Future<String> sendCode(String code) async {
final response = await http.post(
Url.verifyResetPass,
Uri.parse(Url.verifyResetPass),
body: {
'code': code,
},
@@ -74,7 +75,7 @@ class Auth with ChangeNotifier {
print(token);
final response = await http.post(
Url.sendResetPass,
Uri.parse(Url.sendResetPass),
body: {
'password': password,
'password_confirmation': password,
@@ -98,7 +99,7 @@ class Auth with ChangeNotifier {
Future<String> login(String cellNumber, String password) async {
final response = await http.post(
Url.login,
Uri.parse(Url.login),
body: {
'cell_number': cellNumber,
'password': password,
@@ -160,7 +161,7 @@ class Auth with ChangeNotifier {
Future<Map<String, dynamic>> getUserData() async {
final response = await http.get(
Url.getUserInfo,
Uri.parse(Url.getUserInfo),
headers: {'Authorization': 'Bearer ' + token},
);
// print(response.body);
@@ -188,7 +189,7 @@ class Auth with ChangeNotifier {
Future<void> setUserData(id, name, email) async {
var response = await http.post(
'https://cssd-doc.com/api/UpdateInfo',
Uri.parse('https://cssd-doc.com/api/UpdateInfo'),
headers: {
'Authorization': 'Bearer ' + token,
HttpHeaders.contentTypeHeader: 'application/json',