fossasia / visdom

A flexible tool for creating, organizing, and sharing visualizations of live, rich data. Supports Torch and Numpy.
Apache License 2.0
9.93k stars 1.13k forks source link

Extract js-api methods into seperate file #918

Closed da-h closed 1 year ago

da-h commented 1 year ago

Description

This PR refactors server-related functions in the client code by moving them into the js/api/ApiProvider.js component.

Also:

Motivation and Context

The aim was to enhance code readability and reduce the lines of code in main.js. Using useContext has simplified the use of API functions in child components. Previously, these functions needed to be forwarded in the JSX calls, but now they can be accessed globally.

How Has This Been Tested?

-

Screenshots (if appropriate):

Types of changes

Checklist:

da-h commented 1 year ago

I am sorry for the back and forth here with the draft-ing/undraft-ing. With the current submission, however, I am confident that I have not missed anything else. :sweat_smile:

I look forward to read your review of the PR. If you have any suggestions on how we can improve the proposed changes, please let me know.