parent
f622179de1
commit
05ffc72303
@ -0,0 +1,6 @@
|
|||||||
|
import Profil from "../../Models/Profil";
|
||||||
|
|
||||||
|
export default interface IProfileService {
|
||||||
|
getProfiles(): Promise<Profil[]>,
|
||||||
|
addProfile(new_profile: Profil): void
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
import Profil from "../../Models/Profil";
|
||||||
|
import IProfileService from "./IProfileService";
|
||||||
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||||
|
|
||||||
|
export default class ProfileService implements IProfileService {
|
||||||
|
async getProfiles(): Promise<Profil[]> {
|
||||||
|
const existingProfiles = await AsyncStorage.getItem('profiles');
|
||||||
|
return JSON.parse(existingProfiles) || [];
|
||||||
|
}
|
||||||
|
addProfile(new_profile : Profil): void {
|
||||||
|
throw new Error("Method not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue