mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-12 16:58:55 +03:30
1.7.1
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user