mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2025-05-17 03:48:06 +08:00
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:
parent
283c030b37
commit
3331ccb974
5 changed files with 79 additions and 155 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue