Pray to the gods the duplicate subjects bug is fixed. Move irregular status toggle to user info page from subjects page

This commit is contained in:
Keannu Christian Bernasol 2023-07-27 00:01:44 +08:00
parent 283c030b37
commit 3331ccb974
5 changed files with 79 additions and 155 deletions

View file

@ -11,7 +11,7 @@ import {
export let backendURL = "";
export let backendURLWebsocket = "";
let use_production = true;
let use_production = false;
if (__DEV__ && !use_production) {
backendURL = "http://10.0.10.8:8000";
backendURLWebsocket = "ws://10.0.10.8:8000";
@ -224,47 +224,19 @@ export async function GetYearLevels() {
});
}
export async function GetSubjects(
byCourseOnly: boolean,
course: string,
year_level?: string,
semester?: string
) {
export async function GetSubjects() {
const config = await GetConfig();
console.log("by course only?", byCourseOnly);
// If year level and semester specified,
if (!byCourseOnly && year_level && semester) {
return instance
.get(
"/api/v1/subjects/" + course + "/" + year_level + "/" + semester,
config
)
.then((response) => {
// console.log(JSON.stringify(response.data));
return [true, response.data];
})
.catch((error) => {
let error_message = "";
if (error.response) error_message = error.response.data;
else error_message = "Unable to reach servers";
return [false, error_message];
});
}
// If only course is specified
else {
return instance
.get("/api/v1/subjects/" + course, config)
.then((response) => {
// console.log(JSON.stringify(response.data));
return [true, response.data];
})
.catch((error) => {
let error_message = "";
if (error.response) error_message = error.response.data;
else error_message = "Unable to reach servers";
return [false, error_message];
});
}
return instance
.get("/api/v1/subjects/", config)
.then((response) => {
return [true, response.data];
})
.catch((error) => {
let error_message = "";
if (error.response) error_message = error.response.data;
else error_message = "Unable to reach servers";
return [false, error_message];
});
}
export async function OnboardingUpdateStudentInfo(info: OnboardingParams) {