Skip to content

API change name of note #2057

Answered by abitofevrything
Sebiann asked this question in Q&A
Jul 6, 2021 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

You can use this:

async function setNoteTitle(noteId, title) {
    return await api.runOnBackend((noteId, title) => {
        const becca = require('../becca/becca');
        const noteService = require('./notes');
        
        const note = becca.getNote(noteId);

        if (!note) {
            return [404, `Note ${noteId} has not been found`];
        }

        if (!note.isContentAvailable()) {
            return [400, `Note ${noteId} is not available for change`];
        }

        const noteTitleChanged = note.title !== title;

        note.title = title;

        note.save();

        if (noteTitleChanged) {
            noteService.triggerNoteTitleChanged(note);
        }
    }, 

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@zadam
Comment options

@Sebiann
Comment options

@Sebiann
Comment options

Answer selected by Sebiann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants