Merge branch 'temp' of https://codefirst.iut.uca.fr/git/BOB_PARTEAM/BOB_PARTY into temp
continuous-integration/drone/push Build is passing Details

temp
Alban GUILHOT 2 years ago
commit 0b2b1a071a

@ -14,7 +14,7 @@ import StubUser from './src/services/userServices/stub';
export const MANAGER_USER = new ManagerUser(new StubUser, new FakeSaverUser); export const MANAGER_USER = new ManagerUser(new LoaderUserApi, new FakeSaverUser);
export default function App() { export default function App() {

@ -10,6 +10,7 @@ import styles from "./style/Skin.style"
import { useDispatch, useSelector } from "react-redux" import { useDispatch, useSelector } from "react-redux"
import { loginUser } from "../redux/features/currentUserSlice" import { loginUser } from "../redux/features/currentUserSlice"
import { RootState } from "../redux/store" import { RootState } from "../redux/store"
import { MANAGER_USER } from "../../App"
export const SkinComponent : export const SkinComponent :
/* Parameters : /* Parameters :
@ -21,7 +22,6 @@ FC<{skin: Skin, state: String}> =
{ {
const dispatch=useDispatch(); const dispatch=useDispatch();
const currentUser = useSelector((state: RootState) => state.currentUserManager.currentUser);
/* The display of this component depends of the screen from where it has been called: /* The display of this component depends of the screen from where it has been called:
* From the TopBar (icon) : Small image in a circle * From the TopBar (icon) : Small image in a circle
@ -49,7 +49,7 @@ FC<{skin: Skin, state: String}> =
) )
case 'liste': case 'liste':
return( return(
<Pressable onPress={() => {currentUser.setCurrentSkin(skin); dispatch(loginUser(currentUser))}} style={styles.imageWrapper}> <Pressable onPress={() => {MANAGER_USER.getCurrentUser().setCurrentSkin(skin)}} style={styles.imageWrapper}>
<Text style={styles.nomSkin}>{skin.getSkinName()}</Text> <Text style={styles.nomSkin}>{skin.getSkinName()}</Text>
<Image <Image
style={styles.imageSkin} style={styles.imageSkin}

@ -11,6 +11,7 @@ import { User } from "../core/User/user"
import styles from './style/TopBar.style'; import styles from './style/TopBar.style';
import { useSelector } from "react-redux" import { useSelector } from "react-redux"
import { RootState } from "../redux/store" import { RootState } from "../redux/store"
import { MANAGER_USER } from "../../App"
/* /*
Images required Images required
@ -30,8 +31,6 @@ FC<{nav: any, state?: string}> =
({nav, state}) => ({nav, state}) =>
{ {
const currentUser = useSelector((state: RootState) => state.currentUserManager.currentUser);
/* The display of this component depends of the screen from where it has been called: /* The display of this component depends of the screen from where it has been called:
* From the Settings (icon) : Name of the page + cross button * From the Settings (icon) : Name of the page + cross button
* From other : skin + Title + parameters icon * From other : skin + Title + parameters icon
@ -53,7 +52,7 @@ FC<{nav: any, state?: string}> =
return ( return (
<View style={styles.header}> <View style={styles.header}>
<Pressable onPress={() => nav.navigate('ProfileTab', {screen: 'Profile'})}> <Pressable onPress={() => nav.navigate('ProfileTab', {screen: 'Profile'})}>
<SkinComponent skin={currentUser.getCurrentSkin()} state='icon' /> <SkinComponent skin={MANAGER_USER.getCurrentUser().getCurrentSkin()} state='icon' />
</Pressable> </Pressable>
<Text style={styles.titre}>BOB PARTY</Text> <Text style={styles.titre}>BOB PARTY</Text>
<Pressable onPress={() => nav.navigate('Settings')}> <Pressable onPress={() => nav.navigate('Settings')}>

@ -1,9 +0,0 @@
const tabSex = [
{ label: "Homme", value: "Homme" },
{ label: "Femme", value: "Femme" },
{ label: "Non-binaire", value: "Non-binaire" },
{ label: "Autre", value: "Autre" },
]
export default tabSex;

@ -0,0 +1,14 @@
import { Skin } from "./core/skin";
let tabSkinApp:Skin[]=[
new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0),
new Skin("S0002", "Bob Blue",require('bob_party/assets/BobsSkins/BobBlue.png'), 100),
new Skin("S0003", "Bob BW",require('bob_party/assets/BobsSkins/BobBW.png'), 100),
new Skin("S0004", "Bob Green",require('bob_party/assets/BobsSkins/BobGreen.png'), 100),
new Skin("S0005", "Bob P&T",require('bob_party/assets/BobsSkins/BobPinkTurquoise.png'), 100),
new Skin("S0006", "Bob Red",require('bob_party/assets/BobsSkins/BobRed.png'), 100),
new Skin("S0007", "Bob Cute",require('bob_party/assets/BobsSkins/BobYellowGreenBlueHeart.png'), 100),
]
export default tabSkinApp;

@ -1,26 +0,0 @@
import { loginUser } from '../../redux/features/currentUserSlice';
import { updateIncorrectCredentials } from '../../redux/features/credentialErrorsSlice';
import tabUS from "../../constUser";
import { useSelector } from 'react-redux';
import { RootState } from '../../redux/store';
export const checkCredentials = (login: string, password: string, dispatch: any, nav: any) => {
if((tabUS.map((User) => User.getUsername()).indexOf(login)) !== -1){
let id = (tabUS.map((User) => User.getUsername()).indexOf(login))
if ((tabUS.map((User) => User.getUsername()).indexOf(login) === id) && ( tabUS[id].getPassword() === password) ){
dispatch(loginUser(tabUS[id]));
nav.navigate('HomeTab')
}
else{
dispatch(updateIncorrectCredentials(true))
}
}
else{
dispatch(updateIncorrectCredentials(true));
}
};

@ -30,7 +30,7 @@ export class User{
this.currentCoins=currentCoins; this.currentCoins=currentCoins;
this.totalCoins=totalCoins; this.totalCoins=totalCoins;
this.currentSkin=currentSkin; this.currentSkin=currentSkin;
this.tabSkin=tabSkin.copyWithin(tabSkin.length, 0); this.tabSkin=[];
} }

@ -8,11 +8,11 @@ import { FlatList } from 'react-native-gesture-handler';
import { ConversationComponent } from '../components/ConversationComponent'; import { ConversationComponent } from '../components/ConversationComponent';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { RootState } from '../redux/store'; import { RootState } from '../redux/store';
import { MANAGER_USER } from '../../App';
function Chat(props: { navigation: any; }) { function Chat(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
const currentUser = useSelector((state: RootState) => state.currentUserManager.currentUser);
return ( return (
<View style={stylesScreen.container}> <View style={stylesScreen.container}>
@ -20,10 +20,12 @@ function Chat(props: { navigation: any; }) {
nav={navigation} nav={navigation}
/> />
<View style={stylesScreen.bodyStart}> <View style={stylesScreen.bodyStart}>
{/*
<FlatList <FlatList
data={currentUser.getTabConv()} data={MANAGER_USER.getCurrentUser().getTabConv()}
renderItem={({item}) => <ConversationComponent conv={item} state='Preview'/>} renderItem={({item}) => <ConversationComponent conv={item} state='Preview'/>}
/> />
*/}
</View> </View>
<BotBar <BotBar
nav={navigation} nav={navigation}

@ -10,6 +10,7 @@ import { ButtonGreySmall } from '../components/ButtonGreySmall';
import { ScreenIndicator } from '../components/ScreenIndicator'; import { ScreenIndicator } from '../components/ScreenIndicator';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { RootState } from '../redux/store'; import { RootState } from '../redux/store';
import { MANAGER_USER } from '../../App';
const coin = require('../../assets/Icons/Coin.png') const coin = require('../../assets/Icons/Coin.png')
@ -18,7 +19,6 @@ const coin = require('../../assets/Icons/Coin.png')
function Profile(props: { navigation: any; }) { function Profile(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
const currentUser = useSelector((state: RootState) => state.currentUserManager.currentUser);
return ( return (
<View style={stylesScreen.container}> <View style={stylesScreen.container}>
<TopBar <TopBar
@ -26,22 +26,22 @@ function Profile(props: { navigation: any; }) {
/> />
<View style={stylesScreen.bodyStart}> <View style={stylesScreen.bodyStart}>
<ScreenIndicator title='Profil'/> <ScreenIndicator title='Profil'/>
<Text style={styles.pseudoText}>{currentUser.getUsername()}</Text> <Text style={styles.pseudoText}>{MANAGER_USER.getCurrentUser().getUsername()}</Text>
<View style={styles.coinSkinView}> <View style={styles.coinSkinView}>
<View style={styles.coinView}> <View style={styles.coinView}>
<Image <Image
style={styles.coin} style={styles.coin}
source={coin} source={coin}
/> />
<Text style={styles.coinText}>{currentUser.getCurrentCoins()}</Text> <Text style={styles.coinText}>{MANAGER_USER.getCurrentUser().getCurrentCoins()}</Text>
</View> </View>
<View style={styles.skinView}> <View style={styles.skinView}>
<SkinComponent skin={currentUser.getCurrentSkin()} state='profile' /> <SkinComponent skin={MANAGER_USER.getCurrentUser().getCurrentSkin()} state='profile' />
<ButtonGreySmall onPress={() => navigation.navigate('SkinList')} title='Changer de skin' state='Profile'/> <ButtonGreySmall onPress={() => navigation.navigate('SkinList')} title='Changer de skin' state='Profile'/>
</View> </View>
</View> </View>
<View style={styles.infoView}> <View style={styles.infoView}>
<Text style={styles.infoText}>Total de BobCoin gagnés: {currentUser.getTotalCoins()}</Text> <Text style={styles.infoText}>Total de BobCoin gagnés: {MANAGER_USER.getCurrentUser().getTotalCoins()}</Text>
</View> </View>
</View> </View>
<BotBar <BotBar

@ -11,14 +11,15 @@ import DialogInput from "react-native-dialog-input";
import { updatePseudo, updatePassword, updateNationality, updateSex } from "../redux/features/currentUserSlice"; import { updatePseudo, updatePassword, updateNationality, updateSex } from "../redux/features/currentUserSlice";
import Dialog from "react-native-dialog" import Dialog from "react-native-dialog"
import RNPickerSelect from "react-native-picker-select"; import RNPickerSelect from "react-native-picker-select";
import tabNat from '../constNat';
import tabSex from '../constSex';
import { PickerGreySmall } from '../components/PickerGreySmall'; import { PickerGreySmall } from '../components/PickerGreySmall';
import { MANAGER_USER } from '../../App';
import { useUserStore } from '../../userContext';
function Settings(props: { navigation: any; }) { function Settings(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
const setUser = useUserStore((state) => state.setUser);
const currentUser = useSelector((state: RootState) => state.currentUserManager.currentUser);
const [dialogPseudoVisible, setDialogPseudoVisible] = useState(false); const [dialogPseudoVisible, setDialogPseudoVisible] = useState(false);
const [dialogPasswordVisible, setDialogPasswordVisible] = useState(false); const [dialogPasswordVisible, setDialogPasswordVisible] = useState(false);
@ -26,6 +27,21 @@ function Settings(props: { navigation: any; }) {
const [selectedSex, setSelectedSex] = useState(""); const [selectedSex, setSelectedSex] = useState("");
const [selectedNationality, setSelectedNationality] = useState(""); const [selectedNationality, setSelectedNationality] = useState("");
function changeUsername(username:string){
MANAGER_USER.getCurrentUser()?.setUsername(username);
console.log(MANAGER_USER.getCurrentUser()?.getUsername());
setUser(MANAGER_USER.getCurrentUser());
MANAGER_USER.getsaverUser().updateUser(MANAGER_USER.getCurrentUser());
}
function changePassword(password:string){
MANAGER_USER.getCurrentUser()?.setPassword(password);
console.log(MANAGER_USER.getCurrentUser()?.getPassword());
setUser(MANAGER_USER.getCurrentUser());
MANAGER_USER.getsaverUser().updateUser(MANAGER_USER.getCurrentUser());
}
const dispatch=useDispatch(); const dispatch=useDispatch();
return ( return (
@ -40,23 +56,23 @@ function Settings(props: { navigation: any; }) {
<View style={{flexDirection: 'row', justifyContent: 'space-between',}}> <View style={{flexDirection: 'row', justifyContent: 'space-between',}}>
<View> <View>
<View> <View>
<Text style={styles.text}>Pseudo: {currentUser.getUsername()}</Text> <Text style={styles.text}>Pseudo: {MANAGER_USER.getCurrentUser().getUsername()}</Text>
<ButtonGreySmall onPress={() => setDialogPseudoVisible(true)} title='Changer le pseudo'/> <ButtonGreySmall onPress={() => setDialogPseudoVisible(true)} title='Changer le pseudo'/>
</View> </View>
<View> <View>
<Text style={styles.text}>Mot de passe: {currentUser.getPassword()}</Text> <Text style={styles.text}>Mot de passe: {MANAGER_USER.getCurrentUser().getPassword()}</Text>
<ButtonGreySmall onPress={() => setDialogPasswordVisible(true)} title='Changer le mot de passe'/> <ButtonGreySmall onPress={() => setDialogPasswordVisible(true) } title='Changer le mot de passe'/>
</View> </View>
<View> <View>
<Text style={styles.text}>Nationalité: {currentUser.getNationality()}</Text> <Text style={styles.text}>Nationalité: {MANAGER_USER.getCurrentUser().getNationality()}</Text>
<PickerGreySmall title='Changer la nationalité' valueChange={(value:string) => setSelectedNationality(value)} donePress={() => dispatch(updateNationality(selectedNationality))} values={tabNat} /> <PickerGreySmall title='Changer la nationalité' valueChange={(value:string) => setSelectedNationality(value)} donePress={() => dispatch(updateNationality(selectedNationality))} values={["Francais", "Anglais"]} />
</View> </View>
<View> <View>
<Text style={styles.text}>Sexe: {currentUser.getSexe()}</Text> <Text style={styles.text}>Sexe: {MANAGER_USER.getCurrentUser().getSexe()}</Text>
<PickerGreySmall title='Changer le sexe' valueChange={(value:string) => setSelectedSex(value)} donePress={() => dispatch(updateSex(selectedSex))} values={tabSex} /> <PickerGreySmall title='Changer le sexe' valueChange={(value:string) => setSelectedSex(value)} donePress={() => dispatch(updateSex(selectedSex))} values={["Homme", "Femme", "Autre"]} />
</View> </View>
</View> </View>
<Text style={styles.textID}>ID: {currentUser.getId()}</Text> <Text style={styles.textID}>ID: {MANAGER_USER.getCurrentUser().getId()}</Text>
</View> </View>
</View> </View>
</View> </View>
@ -65,7 +81,7 @@ function Settings(props: { navigation: any; }) {
isDialogVisible={dialogPseudoVisible} isDialogVisible={dialogPseudoVisible}
title="Inserer le nouveau pseudo" title="Inserer le nouveau pseudo"
hintInput ="Pseudo" hintInput ="Pseudo"
submitInput={ (inputText: string) => {dispatch(updatePseudo(inputText)); setDialogPseudoVisible(false)} } submitInput={ (inputText: string) => { changeUsername(inputText); setDialogPseudoVisible(false)} }
closeDialog={ () => {setDialogPseudoVisible(false)}}> closeDialog={ () => {setDialogPseudoVisible(false)}}>
</DialogInput> </DialogInput>
@ -73,8 +89,9 @@ function Settings(props: { navigation: any; }) {
isDialogVisible={dialogPasswordVisible} isDialogVisible={dialogPasswordVisible}
title="Inserer le nouveau mot de passe" title="Inserer le nouveau mot de passe"
hintInput ="Mot de passe" hintInput ="Mot de passe"
submitInput={ (inputText: string) => {dispatch(updatePassword(inputText)); setDialogPasswordVisible(false)} } submitInput={ (inputText: string) => { changePassword(inputText); setDialogPasswordVisible(false)} }
closeDialog={ () => {setDialogPasswordVisible(false)}}> closeDialog={ () => {setDialogPasswordVisible(false)}}>
</DialogInput> </DialogInput>
</View> </View>

@ -1,22 +1,23 @@
import { StatusBar } from 'expo-status-bar' import { StatusBar } from 'expo-status-bar'
import { View, Pressable, Text, Alert} from 'react-native' import { View, Pressable, Text, Alert} from 'react-native'
import React, { useState } from 'react'; import React, { useCallback, useState } from 'react';
import stylesScreen from './style/screens.style' import stylesScreen from './style/screens.style'
import { TextInput } from 'react-native-gesture-handler'; import { TextInput } from 'react-native-gesture-handler';
import styles from "./style/SignIn.style"; import styles from "./style/SignIn.style";
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import tabUS from '../constUser';
import { loginUser } from '../redux/features/currentUserSlice'; import { loginUser } from '../redux/features/currentUserSlice';
import { checkCredentials } from '../core/Auth/login';
import { RootState } from '../redux/store'; import { RootState } from '../redux/store';
import { updateIncorrectCredentials } from '../redux/features/credentialErrorsSlice'; import { updateIncorrectCredentials } from '../redux/features/credentialErrorsSlice';
import Dialog from "react-native-dialog"; import Dialog from "react-native-dialog";
import { MANAGER_USER } from '../../App';
import { useUserStore } from '../../userContext';
function SignIn(props: { navigation: any; }) { function SignIn(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
const setUser = useUserStore((state) => state.setUser);
const errorList = useSelector((state: RootState) => state.credentialErrors.loginErrorList); const errorList = useSelector((state: RootState) => state.credentialErrors.loginErrorList);
@ -29,12 +30,28 @@ function SignIn(props: { navigation: any; }) {
dispatch(updateIncorrectCredentials(true)); dispatch(updateIncorrectCredentials(true));
} }
const handleUserConnect = useCallback(async (pseudo: string, password: string) => {
const us =await MANAGER_USER.getLoaderUser().loadByUsernamePassword(pseudo, password).then((res) => {
if (res!=null){
MANAGER_USER.setCurrentUser(res);
navigation.navigate('HomeTab');
setUser(MANAGER_USER.getCurrentUser());
}
else{
console.log("wesh c'est null");
}
});
}, []);
return ( return (
<View style={stylesScreen.container}> <View style={stylesScreen.container}>
<View style={stylesScreen.bodyCenter}> <View style={stylesScreen.bodyCenter}>
<TextInput style={styles.textInput} placeholder='Login' onChangeText={(val) => setPseudo(val)} autoCapitalize='none' /> <TextInput style={styles.textInput} placeholder='Login' onChangeText={(val) => setPseudo(val)} autoCapitalize='none' />
<TextInput style={styles.textInput} placeholder='Password' onChangeText={(val) => setPassword(val)} autoCapitalize='none' secureTextEntry={true}/> <TextInput style={styles.textInput} placeholder='Password' onChangeText={(val) => setPassword(val)} autoCapitalize='none' secureTextEntry={true}/>
<Pressable style={styles.button} onPress={() => checkCredentials(pseudo, password, dispatch, navigation)}> <Pressable style={styles.button} onPress={() => handleUserConnect(pseudo, password)}>
<Text style={styles.text}>Se connecter</Text> <Text style={styles.text}>Se connecter</Text>
</Pressable> </Pressable>
<Pressable onPress={() => navigation.navigate('SignUp')}> <Pressable onPress={() => navigation.navigate('SignUp')}>

@ -10,8 +10,6 @@ import { useDispatch, useSelector } from 'react-redux';
import { checkNewUserValidity } from '../core/Auth/newUser'; import { checkNewUserValidity } from '../core/Auth/newUser';
import DateTimePicker, { DateTimePickerEvent } from '@react-native-community/datetimepicker'; import DateTimePicker, { DateTimePickerEvent } from '@react-native-community/datetimepicker';
import RNPickerSelect from "react-native-picker-select"; import RNPickerSelect from "react-native-picker-select";
import tabSex from '../constSex';
import tabNat from '../constNat';
import { PickerGreySmall } from '../components/PickerGreySmall'; import { PickerGreySmall } from '../components/PickerGreySmall';
import { loginUser } from '../redux/features/currentUserSlice'; import { loginUser } from '../redux/features/currentUserSlice';
import { RootState } from '../redux/store'; import { RootState } from '../redux/store';
@ -121,12 +119,12 @@ function SignUp(props: { navigation: any; }) {
<View style={{width: '60%', alignItems: 'center'}}> <View style={{width: '60%', alignItems: 'center'}}>
<Text style={styles.text}>Nationalité</Text> <Text style={styles.text}>Nationalité</Text>
<PickerGreySmall title='Choisir la Nationalité' valueChange={(value:string) => <PickerGreySmall title='Choisir la Nationalité' valueChange={(value:string) =>
setSelectedNationality(value)} values={tabNat} /> setSelectedNationality(value)} values={["Français", "Anglais"]} />
</View> </View>
<View style={{width: '60%', alignItems: 'center'}}> <View style={{width: '60%', alignItems: 'center'}}>
<Text style={styles.text}>Sexe</Text> <Text style={styles.text}>Sexe</Text>
<PickerGreySmall title='Choisir le sexe' valueChange={(value:string) => setSelectedSex(value)} values={tabSex} /> <PickerGreySmall title='Choisir le sexe' valueChange={(value:string) => setSelectedSex(value)} values={["Homme","Femme", "Autre"]} />
</View> </View>
<Pressable style={styles.button} onPress={() => checkNewUserValidity(pseudo,password,date,selectedNationality,selectedSex, dispatch, navigation)}> <Pressable style={styles.button} onPress={() => checkNewUserValidity(pseudo,password,date,selectedNationality,selectedSex, dispatch, navigation)}>
<Text style={styles.text}>S'inscrire</Text> <Text style={styles.text}>S'inscrire</Text>

@ -9,11 +9,11 @@ import { SkinComponent } from '../components/Skin';
import { ScreenIndicator } from '../components/ScreenIndicator'; import { ScreenIndicator } from '../components/ScreenIndicator';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { RootState } from '../redux/store'; import { RootState } from '../redux/store';
import { MANAGER_USER } from '../../App';
function Store(props: { navigation: any; }) { function Store(props: { navigation: any; }) {
const { navigation } = props const { navigation } = props
const currentUser = useSelector((state: RootState) => state.currentUserManager.currentUser);
return ( return (
<View style={stylesScreen.container}> <View style={stylesScreen.container}>
@ -23,7 +23,7 @@ function Store(props: { navigation: any; }) {
<View style={stylesScreen.bodyStart}> <View style={stylesScreen.bodyStart}>
<ScreenIndicator title='Store'/> <ScreenIndicator title='Store'/>
<FlatList <FlatList
data={currentUser.getTabSkin()} data={MANAGER_USER.getCurrentUser().getTabSkin()}
numColumns={2} numColumns={2}
columnWrapperStyle={{ flex: 1, justifyContent: "space-around"}} columnWrapperStyle={{ flex: 1, justifyContent: "space-around"}}
keyExtractor={item =>item.getSkinName()} keyExtractor={item =>item.getSkinName()}

@ -7,17 +7,17 @@ export default interface ISaverUser{
* u the user we want to save * u the user we want to save
*/ */
saveUser(u:User): Promise<void>; saveUser(u:User | null): Promise<void>;
/** /**
* deleteUser methode that delete a User in the data management system * deleteUser methode that delete a User in the data management system
* u the user we want to delete * u the user we want to delete
*/ */
deleteUser(u:User):Promise<void>; deleteUser(u:User | null):Promise<void>;
/** /**
* updateUser methode that update a User in the data management system * updateUser methode that update a User in the data management system
* u the user we want to update * u the user we want to update
*/ */
updateUser(u:User): Promise<void>; updateUser(u:User | null): Promise<void>;
} }

@ -1,5 +1,6 @@
import { Conversation } from "../../core/conversation"; import { Conversation } from "../../core/conversation";
import { Match } from "../../core/match"; import { Match } from "../../core/match";
import { Skin } from "../../core/skin";
import { User } from "../../core/User/user"; import { User } from "../../core/User/user";
import ILoaderUser from "./ILoaderUser"; import ILoaderUser from "./ILoaderUser";
@ -87,31 +88,21 @@ export default class LoaderUserApi implements ILoaderUser{
return null; return null;
} }
async loadByUsernamePassword(username: string, password: string): Promise<User | null>{
async loadByUsernamePassword(username: string, password: string): Promise<User | null> { let user:User | null=null;
let test = new Test(true, 0, "wesh", 0);
try{
await this.axios({ await this.axios({
method: 'get', method: 'get',
url: 'https://jsonplaceholder.typicode.com/todos/1', url: 'https://jsonplaceholder.typicode.com/todos/1',
params: { params: {
name: "getUserForConnection", name: "getAllUser",
username: username,
password: password,
//Les params genre nom de la fonction en php //Les params genre nom de la fonction en php
} }
}) })
.then(function (response: any) { .then(function (response: any) {
console.log(response.data); user=new User("U0001", username, password, "ouioui", "homme", new Date(2022,12,12), 12222, 123324, 12, new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0), [new Skin("S0001", "Bob",require('bob_party/assets/BobsSkins/BobClassic.png'), 0)]);
Object.assign(test, response.data);
console.log(test.id);
}); });
}catch (error) { return user;
console.error(error);
} }
return null;
}
async loadUserByMatch(m: Match): Promise<User[]> { async loadUserByMatch(m: Match): Promise<User[]> {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");

Loading…
Cancel
Save