Skip to content

Commit

Permalink
Merge pull request #117 from credebl/228-user-profile-management
Browse files Browse the repository at this point in the history
Integrate Update User Profile API (frontend)
  • Loading branch information
nishad-ayanworks authored Aug 22, 2023
2 parents 39dcd32 + f1f2663 commit c2e53fa
Show file tree
Hide file tree
Showing 6 changed files with 602 additions and 351 deletions.
31 changes: 29 additions & 2 deletions src/api/Auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {axiosGet, axiosPost} from '../services/apiRequests'
import {axiosGet, axiosPost, axiosPut} from '../services/apiRequests'
import { number, string } from 'yup'

import type { AxiosError } from 'axios'
Expand Down Expand Up @@ -73,7 +73,34 @@ export const getUserProfile = async(accessToken: string) => {
}
}

export const verifyUserMail = async(payload: EmailVerifyData) => {
export const updateUserProfile = async(data: object ) => {
const url = apiRoutes.users.update
const payload = data
const token = await getFromLocalStorage(storageKeys.TOKEN)

const config = {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
}
}
const axiosPayload = {
url,
payload,
config
}

try {
return await axiosPut(axiosPayload);
}
catch (error) {
const err = error as Error
return err?.message
}

}

export const verifyUserMail = async(payload: EmailVerifyData ) => {
const details ={
url:`${apiRoutes.auth.verifyEmail}?verificationCode=${payload?.verificationCode}&email=${payload?.email}`,
config: { headers: { "Content-type": "application/json" } }
Expand Down
Loading

1 comment on commit c2e53fa

@deno-deploy
Copy link
Contributor

@deno-deploy deno-deploy bot commented on c2e53fa Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

HTTP status server error (500 Internal Server Error) for url (https://deno.land/std@0.177.0/async/mod.ts)

Please sign in to comment.