Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
milosnowcat committed Jul 4, 2022
1 parent 94b7a14 commit 70aa086
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/version.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"App": {
"name": "inventory.php",
"by": "RAH Code",
"version": "2022"
"version": "2022.1"
}
}
20 changes: 18 additions & 2 deletions inventory.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,33 @@

</table>

<p id="version"></p>

<!-- Check the app version -->
<script>
var version = 0
var url = 'docs/version.json';
fetch(url)
.then(response => response.json())
.then(json => {

// Do stuff with the contents of the JSON file here
version = json.App.version;
console.log(version);
document.getElementById("version").innerHTML = "Your version: " +
version;
return version;
});

var url = 'https://inventoryphp.rahcode.com/version.json';
fetch(url)
.then(response => response.json())
.then(json => {
console.log(json);
// Do stuff with the contents of the JSON file here
if(json.App.version != 2021){
if (version != json.App.version){
alert("Contact the administrator to update your app to the latest version");
document.getElementById("update").innerHTML = "<a href='docs'>Update Here</a>"
document.getElementById("update").innerHTML = "<a href='docs'>Update Here</a>";
}
});
</script>
Expand Down

0 comments on commit 70aa086

Please sign in to comment.