...
 
Commits (2)
import Axios from 'axios';
export enum AssignmentType {
TASK = 0,
}
export interface Assignment {
id: string,
nonce: string,
updatedAt: string | null,
subject: string,
type: AssignmentType,
title: string,
description: string,
class: string | null,
dueDate: string | null,
complete: boolean
}
export async function fetchAssignments(): Promise<Assignment[]> {
return (await Axios.get('https://edupack.insrt.uk/api/assignments/list')).data;
}
export interface PartialAssignment {
id?: string,
nonce: string,
subject?: string,
type?: AssignmentType,
title?: string,
description?: string,
class?: string,
dueDate?: string,
complete?: boolean
}
export async function updateAssignment(assignment: PartialAssignment): Promise<{ [key in 'id' | 'nonce']: string }> {
return (await Axios.post('https://edupack.insrt.uk/api/assignments/update', assignment)).data;
}
export async function deleteAssignment(id: string) {
await Axios.post('https://edupack.insrt.uk/api/assignments/delete', { id });
}
\ No newline at end of file
import axios from 'axios';
import Axios from 'axios';
export interface UserInfo {
givenName: string,
......@@ -7,5 +7,5 @@ export interface UserInfo {
}
export async function fetchUserInfo(): Promise<UserInfo> {
return (await axios.get('https://edupack.insrt.uk/api/info/@me')).data;
return (await Axios.get('https://edupack.insrt.uk/api/info/@me')).data;
}
\ No newline at end of file
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import Loader from './Loader';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(<Loader />, document.getElementById('root'));
ReactDOM.render(<h1>edupack</h1>, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
......
......@@ -11,7 +11,7 @@ import DoneIcon from '@material-ui/icons/Done';
import EditIcon from '@material-ui/icons/Edit';
import CloseIcon from '@material-ui/icons/Close';
import DeleteIcon from '@material-ui/icons/Delete';
import { SubjectIcon } from './util/Icon';
import { SubjectIcon } from '../util/Icon';
import moment from 'moment';
import Axios from 'axios';
......
import React, { useState, Fragment, createContext } from 'react';
import Login from './pages/Login';
import Login from '../pages/Login';
import { Typography, CssBaseline, Container, makeStyles } from '@material-ui/core';
import { MuiPickersUtilsProvider } from '@material-ui/pickers';
import DateFnsUtils from '@date-io/date-fns';
import { fetchUserInfo, UserInfo } from './api/info';
import { fetchUserInfo, UserInfo } from '../api/info';
import App from './App';
export const UserContext = createContext<UserInfo>({} as any),
......
import React from 'react';
export default () => {
return (
<h1>test</h1>
);
};
\ No newline at end of file
......@@ -6,7 +6,7 @@ import HelpOutlineIcon from '@material-ui/icons/HelpOutline';
import CloseIcon from '@material-ui/icons/Close';
import loginWithGoogle from './lwg.svg';
import { useStyles } from '../Loader';
import { useStyles } from '../old_code/Loader';
const ErrorMap = {
db_fail: 'There was a problem with the database.',
......