mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-23 13:29:35 +02:00
import from up to date repo
This commit is contained in:
parent
35f5db62f2
commit
12baf72567
86 changed files with 12080 additions and 13746 deletions
|
@ -1,34 +1,32 @@
|
|||
import axios from 'axios';
|
||||
import { store } from '../store/store';
|
||||
import { createNotification } from '../store/action-creators';
|
||||
import { useCreateNotification } from '../state/notification';
|
||||
|
||||
export const checkVersion = async (isForced: boolean = false) => {
|
||||
try {
|
||||
const res = await axios.get<string>(
|
||||
'https://raw.githubusercontent.com/pawelmalak/flame/master/client/.env'
|
||||
);
|
||||
export const useCheckVersion = (isForced: boolean = false) => {
|
||||
const createNotification = useCreateNotification();
|
||||
return async () => {
|
||||
try {
|
||||
const res = await axios.get<string>(
|
||||
'https://raw.githubusercontent.com/GeorgeSG/flame/master/client/.env'
|
||||
);
|
||||
|
||||
const githubVersion = res.data
|
||||
.split('\n')
|
||||
.map((pair) => pair.split('='))[0][1];
|
||||
const githubVersion = res.data
|
||||
.split('\n')
|
||||
.map((pair) => pair.split('='))[0][1];
|
||||
|
||||
if (githubVersion !== process.env.REACT_APP_VERSION) {
|
||||
store.dispatch<any>(
|
||||
if (githubVersion !== process.env.REACT_APP_VERSION) {
|
||||
createNotification({
|
||||
title: 'Info',
|
||||
message: 'New version is available!',
|
||||
url: 'https://github.com/pawelmalak/flame/blob/master/CHANGELOG.md',
|
||||
})
|
||||
);
|
||||
} else if (isForced) {
|
||||
store.dispatch<any>(
|
||||
url: 'https://github.com/GeorgeSG/flame/blob/master/CHANGELOG.md',
|
||||
});
|
||||
} else if (isForced) {
|
||||
createNotification({
|
||||
title: 'Info',
|
||||
message: 'You are using the latest version!',
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue