feat: Implement getLevelVocab
This commit is contained in:
parent
f26ce20e13
commit
d452088253
@ -27,6 +27,7 @@ import { IResponse } from "../models/server";
|
|||||||
interface IProps {
|
interface IProps {
|
||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
|
|
||||||
|
user: IUser;
|
||||||
setAuthenticated: (status: boolean) => void;
|
setAuthenticated: (status: boolean) => void;
|
||||||
setUser: (user: IUser) => void;
|
setUser: (user: IUser) => void;
|
||||||
};
|
};
|
||||||
@ -162,37 +163,22 @@ export default class Application extends React.Component<IProps> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getLevelVocab(id: number): Promise<IVocab[]> {
|
getLevelVocab = (id: number): Promise<IVocab[]> => {
|
||||||
console.log("STUB: Application::getLevelVocab");
|
|
||||||
|
|
||||||
// TODO: Actually implement this
|
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
setTimeout(() => {
|
fetch(`${BACKEND_URL}/auth/level/${id}/vocab`, {
|
||||||
res([{
|
method: "GET",
|
||||||
german: ["Wein"],
|
headers: new Headers({
|
||||||
hint: "Worte auf '-um' sind meistens NeutrUM",
|
"Content-Type": "application/json",
|
||||||
type: VocabType.NOMEN,
|
"Token": this.props.user.sessionToken,
|
||||||
latin: {
|
}),
|
||||||
grundform: "Vinum",
|
}).then(data => data.json())
|
||||||
genitiv: "Vini",
|
.then((resp: IResponse) => {
|
||||||
genus: "Neutrum"
|
if (resp.error === "0") {
|
||||||
},
|
res(resp.data.vocab);
|
||||||
id: 0
|
} else {
|
||||||
}/* , {
|
rej(resp);
|
||||||
* latin: "Vici",
|
}
|
||||||
* german: "<Wortbedeutung>",
|
});
|
||||||
* hint: "Wird \"Viki\" und nicht \"Vichi\" ausgesprochen",
|
|
||||||
* mnemonic: "Merk dir das Wort mit Caesars berühmten Worten: \"Veni Vidi Vici\"; Er kam, sah und siegte",
|
|
||||||
* type: VocabType.NOMEN,
|
|
||||||
* id: 2
|
|
||||||
}, {
|
|
||||||
* latin: "fuga",
|
|
||||||
* german: "Flucht",
|
|
||||||
* hint: "Worte auf \"-a\" sind FeminA",
|
|
||||||
* type: VocabType.NOMEN,
|
|
||||||
* id: 3
|
|
||||||
} */]);
|
|
||||||
}, 2000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import { setAuthenticated, setUser } from "../actions";
|
|||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
return {
|
return {
|
||||||
authenticated: state.authenticated,
|
authenticated: state.authenticated,
|
||||||
|
user: state.user,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
|
Reference in New Issue
Block a user