Skip to content

Commit

Permalink
fixed the update status as well as cancel ooo api call
Browse files Browse the repository at this point in the history
  • Loading branch information
shreya-mishra committed Oct 9, 2023
1 parent f1f85cf commit d1a70fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/screens/AuthScreen/Util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,6 @@ export const formatTimeToUnix = (date) => {
const newDate = new Date(date);

// Convert the date to Unix Epoch timestamp in seconds
const unixTimestampInSeconds = newDate.getTime() / 1000;
const unixTimestampInSeconds = newDate.getTime();
return unixTimestampInSeconds;
};
7 changes: 5 additions & 2 deletions src/screens/HomeScreen/HomeScreenV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const HomeScreenV2 = (): JSX.Element => {

const handleButtonPress = async () => {
if (status === 'OOO') {
setIsLoading(true);
await cancelOoo(loggedInUserData?.token);
setIsLoading(false);
} else {
setIsFormVisible((prev) => !prev);
}
Expand All @@ -50,10 +52,11 @@ const HomeScreenV2 = (): JSX.Element => {
message: description,
state: 'OOO',
until: formatTimeToUnix(toDate),
updateAt: formatTimeToUnix(Date.now),
updatedAt: formatTimeToUnix(currentDate),
},
};
await submitOOOForm(data, loggedInUserData?.token);
const res = await submitOOOForm(data, loggedInUserData?.token);
console.log(res);
setIsLoading(false); // Clear loading state after API call
setIsFormVisible(false); // Hide the form after a successful submission
};
Expand Down
2 changes: 1 addition & 1 deletion src/screens/ProfileScreen/ProfileScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import UploadImageModalView from '../../components/GalleryModal';
import { AuthContext } from '../../context/AuthContext';
import { ImagePickerResponse } from 'react-native-image-picker';
import Strings from '../../i18n/en';
import AllContributionsDropdown from './User Data/UserContributions/AllContributions';
import NoteworthyContributionsDropdown from './User Data/UserContributions/NoteWorthyContributions';
import ActiveTaskDropDown from './User Data/UserContributions/ActiveTask';
import UserData from './User Data/UserData';
import { useSelector, useDispatch } from 'react-redux';
import AllContributionsDropdown from './User Data/UserContributions/AllContributions';

const ProfileScreen = () => {
const dispatch = useDispatch();
Expand Down

0 comments on commit d1a70fc

Please sign in to comment.