-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PMM-11231 Use correct naming & switch to hooks
- Loading branch information
1 parent
ff0388a
commit ae5d5d8
Showing
5 changed files
with
47 additions
and
37 deletions.
There are no files selected for viewing
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,17 @@ | ||
import { checkForUpdates } from 'api/updates'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
export const useCheckUpdates = () => | ||
useQuery({ | ||
queryKey: ['checkUpdates'], | ||
queryFn: async () => { | ||
try { | ||
return await checkForUpdates(); | ||
} catch (error) { | ||
return await checkForUpdates({ | ||
force: false, | ||
onlyInstalledVersion: true, | ||
}); | ||
} | ||
}, | ||
}); |
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 |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import { getCurrentVersion } from 'api/version'; | ||
import { VersionInfo } from 'types/updates.types'; | ||
import { formatTimestamp } from 'utils/formatTimestamp'; | ||
|
||
export const getVersion = async () => { | ||
try { | ||
const res = await getCurrentVersion(); | ||
return res; | ||
} catch (error) { | ||
const res = await getCurrentVersion({ | ||
force: false, | ||
onlyInstalledVersion: true, | ||
}); | ||
return res; | ||
export const formatVersion = ({ version, timestamp, tag }: VersionInfo) => { | ||
const text = | ||
` ${version}` + (timestamp ? `, ${formatTimestamp(timestamp)}` : ''); | ||
|
||
if (version === '0.0.0') { | ||
return `${text}, ${tag}`; | ||
} | ||
|
||
return text; | ||
}; |
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