This commit is contained in:
Peter Hoppe
2023-01-04 12:54:01 +01:00
parent 54b089c0ee
commit 8a42c3a506
5 changed files with 230 additions and 0 deletions

View File

@ -48,6 +48,12 @@ export type UserCtxT =
password: string;
}) => Promise<any>,
updateDog: ({ email, name, phone }: {
email: string;
name: string;
phone: string;
}) => Promise<any>,
loginUser: (
{ email, password } :
{
@ -104,6 +110,24 @@ export const UserCtxProvider = ({children}:TUserContextProviderProps) => {
}
}
const updateDog = async ({email, name, phone}:
{email: string, name: string, phone: string}) => {
setWait(true);
try{
const {data} = await Axios.post('updateDog.php',{
email,
name,
phone
});
setWait(false);
return data;
}
catch(err){
setWait(false);
return {success:0, message:'Server Error!'};
}
}
const loginUser = async ({email,password}:{email: string, password: string}) =>
{
setWait(true);
@ -212,6 +236,7 @@ export const UserCtxProvider = ({children}:TUserContextProviderProps) => {
<UserCtx.Provider value={
{
registerUser,
updateDog,
loginUser,
wait,
user,