Skip to content

Commit

Permalink
add error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
divear committed Aug 13, 2024
1 parent aa6a805 commit 6a1b3ed
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ body {
height: 100%;
overflow: hidden;
}
@media (prefers-color-scheme: dark) {
html,
body {
background: black;
color: white;
}
}

@layer utilities {
.text-balance {
Expand Down
6 changes: 5 additions & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";
// import Image from "next/image";
import { useState } from "react";
import { invoke } from "@tauri-apps/api/tauri";
// import logo from "../public/vercel.svg";
import { useState } from "react";

export default function Home() {
const [error, setError] = useState("");
Expand All @@ -28,6 +28,10 @@ export default function Home() {
invoke<string>("subjects", { username, password })
.then((result) => {
console.log(result);
if (result[0] == "could not get subjects") {
setError("Could not get subjects.");
return;
}
setSubjects(result[0]);
setGrades(result[1]);
console.log(result[1]);
Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@heroicons/react": "^2.1.5",
"@tauri-apps/api": "^1.6.0",
"next": "14.2.5",
"react": "^18",
Expand Down

0 comments on commit 6a1b3ed

Please sign in to comment.