2020-03-18 02:00:22 +00:00
|
|
|
|
2020-03-26 01:30:12 +00:00
|
|
|
var add = function() {
|
2020-03-26 15:10:55 +00:00
|
|
|
let millis = Date.parse($('#published')[0].value)
|
2020-03-26 01:30:12 +00:00
|
|
|
db.collection("bibliotek").add({
|
|
|
|
tittel: $('#title')[0].value,
|
|
|
|
forfatter: $('#author')[0].value,
|
|
|
|
forlag: $('#publisher')[0].value,
|
|
|
|
terningkast: $('#rating')[0].value,
|
2020-03-26 15:10:55 +00:00
|
|
|
utgitt: new firebase.firestore.Timestamp(millis/1000, 0)
|
2020-03-26 01:30:12 +00:00
|
|
|
}).then(function() {
|
2020-03-26 01:34:18 +00:00
|
|
|
$('#status').html('<p style="color: green;">La til bok '+$('#title')[0].value+'!</p>')
|
2020-03-26 01:30:12 +00:00
|
|
|
}).catch(function() {
|
2020-03-26 01:34:18 +00:00
|
|
|
$('#status').html('<p style="color: red;">Problem med å legge til bok '+$('#title')[0].value+'!</p>')
|
2020-03-26 01:30:12 +00:00
|
|
|
})
|
|
|
|
}
|
2020-03-18 02:00:22 +00:00
|
|
|
|