Small refactor

This commit is contained in:
Joshen Lim committed 2022-07-14 22:44:46 +08:00
1 parent d581d787d9
commit a498cb4dbb
3 files changed
+11 -20

No files matched your search

@@ -0,0 +1,9 @@
// Invite is expired if older than 24hrs
export function isInviteExpired(timestamp: Date) {
const inviteDate = new Date(timestamp)
const now = new Date()
var timeBetween = now.valueOf() - inviteDate.valueOf()
if (timeBetween / 1000 / 60 / 60 < 24) {
return true
}
}
@@ -7,6 +7,7 @@ import { useOrganizationDetail, useStore } from 'hooks'
import { Member } from 'types'
import { API_URL } from 'lib/constants'
import { post, delete_ } from 'lib/common/fetch'
import { isInviteExpired } from './Organization.utils'
import { PageContext } from 'pages/org/[slug]/settings'
import TextConfirmModal from 'components/ui/Modals/TextConfirmModal'
import { confirmAlert } from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModal'
@@ -23,16 +24,6 @@ const OwnerDropdown = observer(({ members, member }: any) => {
const { id: orgId, slug: orgSlug, name: orgName } = PageState.organization
// Invite is expired if older than 24hrs
function isInviteExpired(timestamp: Date) {
const inviteDate = new Date(timestamp)
const now = new Date()
var timeBetween = now.valueOf() - inviteDate.valueOf()
if (timeBetween / 1000 / 60 / 60 < 24) {
return true
}
}
async function handleMemberDelete() {
await timeout(200)
+1 -10
View File
@@ -36,21 +36,12 @@ import {
import Table from 'components/to-be-cleaned/Table'
import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel'
import { confirmAlert } from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModal'
import { isInviteExpired } from 'components/interfaces/Organization/Organization.utils'
// [Joshen] Low prio refactor: Bring out general and team settings into their own components too
export const PageContext = createContext(null)
// Invite is expired if older than 24hrs
function isInviteExpired(timestamp: Date) {
const inviteDate = new Date(timestamp)
const now = new Date()
var timeBetween = now.valueOf() - inviteDate.valueOf()
if (timeBetween / 1000 / 60 / 60 < 24) {
return true
}
}
const OrgSettingsLayout = withAuth(
observer(({ children }) => {
const { app, ui } = useStore()