-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
281 additions
and
529 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import axios from 'axios'; | ||
// const baseUrl = 'http://192.168.1.11:3000'; | ||
// const baseUrl = 'http://192.168.1.11:5001/pushcartping/us-central1/app'; | ||
const baseUrl = 'https://us-central1-pushcartping.cloudfunctions.net/app'; | ||
|
||
export const axFetchCustomerData = async (uid) => { | ||
const url = `${baseUrl}/user/${uid}`; | ||
const response = await axios.get(url); | ||
const data = await response.data; | ||
return { status: response.status, data: data }; | ||
}; | ||
|
||
export const axAddCustomerToDatabase = async ({ uid, userName = '', userEmail = '', userPhotoURL = '' }) => { | ||
const url = `${baseUrl}/user/${uid}`; | ||
const response = await axios.post(url, { | ||
userName, | ||
userEmail, | ||
userPhotoURL | ||
}); | ||
const data = await response.data; | ||
return { status: response.status, data: data }; | ||
} | ||
|
||
export const axFetchVendorData = async (uid) => { | ||
const url = `${baseUrl}/vendor/${uid}`; | ||
const response = await axios.get(url); | ||
const data = await response.data; | ||
return { status: response.status, data: data }; | ||
}; | ||
|
||
export const axAddVendorToDatabase = async ({ uid, userName = '', userEmail = '', userPhotoURLs = [], userCategory = '', userTagline = '', userDescription = '' }) => { | ||
const url = `${baseUrl}/vendor/${uid}`; | ||
const response = await axios.post(url, { | ||
userName, | ||
userEmail, | ||
userPhotoURLs, | ||
userCategory, | ||
userTagline, | ||
userDescription, | ||
}); | ||
const data = await response.data; | ||
return { status: response.status, data: data }; | ||
} | ||
|
||
export const axSetCurrentVendorLocation = async ({ uid, latitude, longitude }) => { | ||
const url = `${baseUrl}/vendor/${uid}`; | ||
const response = await axios.patch(url, { | ||
latitude, | ||
longitude, | ||
}); | ||
const data = await response.data; | ||
return { status: response.status, data: data }; | ||
} | ||
|
||
export const axGetAllVendorsFromDB = async () => { | ||
const url = `${baseUrl}/vendor/get/all`; | ||
const response = await axios.get(url); | ||
const data = await response.data; | ||
return { status: response.status, data: data }; | ||
} |
Oops, something went wrong.