1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-23 13:29:35 +02:00

Case-insensitive sorting. App version checking

This commit is contained in:
unknown 2021-06-15 12:36:23 +02:00
parent e884c84aa8
commit 9a1ec76ffd
15 changed files with 104 additions and 11 deletions

View file

@ -0,0 +1,27 @@
import axios from 'axios';
import { store } from '../store/store';
import { createNotification } from '../store/actions';
export const checkVersion = async (isForced: boolean = false) => {
try {
const res = await axios.get<string>('https://raw.githubusercontent.com/pawelmalak/flame/master/client/.env');
const githubVersion = res.data
.split('\n')
.map(pair => pair.split('='))[0][1];
if (githubVersion !== process.env.REACT_APP_VERSION) {
store.dispatch<any>(createNotification({
title: 'Info',
message: 'New version is available!'
}))
} else if (isForced) {
store.dispatch<any>(createNotification({
title: 'Info',
message: 'You are using the latest version!'
}))
}
} catch (err) {
console.log(err);
}
}