-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audit/issues #23
base: main
Are you sure you want to change the base?
Audit/issues #23
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,31 @@ import type { | |
TraversalStep | ||
} from "@/types/typesSearch" | ||
|
||
const SERVER_URL = 'https://algorithm-visualisations-express-production.up.railway.app' | ||
const DEPLOYED_SERVER_URL = 'https://algorithm-visualisations-express-production.up.railway.app' | ||
|
||
async function selectServerUrl() { | ||
const hasNetworkConnection = await axios({ | ||
method: "GET", | ||
url: `${DEPLOYED_SERVER_URL}` | ||
}) | ||
|
||
console.log('can we access the remote server:', hasNetworkConnection) | ||
|
||
if (hasNetworkConnection) { | ||
return DEPLOYED_SERVER_URL | ||
} else { | ||
return 'http://localhost:8080' | ||
} | ||
|
||
} | ||
|
||
// It's not clear to me why this promise is getting rejected? | ||
const TEST_URL = selectServerUrl() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
console.log('server', TEST_URL) | ||
|
||
const SERVER_URL = 'http://localhost:8080' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
|
||
// Search: DFS -> take in a graph and a target and return a set | ||
export async function getDFS(graph: Graph<string>, currentVertex: string, target: string|null): Promise<TraversalStep[] | null> { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The network connectivity check is incorrect.
hasNetworkConnection
will always be truthy if the request doesn't throw an error. Consider using a try-catch block to handle errors and determine connectivity.